Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- fit xy-dataset with minerr in a loop

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-24-2013
12:17 PM

01-24-2013
12:17 PM

fit xy-dataset with minerr in a loop

Hello,

I want to fit with minerr a sinus function. The sampled xy-dataset consists of e.g 20 periods of a sinus signal. I want to know the period (time of oscillation) of each of the 20 periods. In a loop I want to fit with minerr the data. How can I do it? I attached the data-file and the mathcad 15 document with with the programming I've done so far (just look at the red marked boxes).

thanks.

ur

Labels:

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-24-2013
01:31 PM

01-24-2013
01:31 PM

Re: fit xy-dataset with minerr in a loop

what do you expect to get with (F(as,X) - Y)^2 ? If you want these to matrices to be (as) equal (as possible), you would have to write F(as,Y)=Y instead.

Q(Y)= gives you a 4x1 vector with values slightly different from the start value as. Q(D) gives you still an error because the way you have written it Q is a function with a 500x20 matrix as the argument, D is a 500x1 vector - the dimensions simply do not match.

Y is and F returns a 500x20 matrix, the difference is a 500x20 matrix, too.

You can not square a non-square matrix and thats why Mathcad delivers the error message "This matrix must be square" when you try to use Q (a function you assigned minerr to) the first time.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-24-2013
01:37 PM

01-24-2013
01:37 PM

Re: fit xy-dataset with minerr in a loop

Since you have such a nice sinusoidal signal, why not use an FFT to derive the fit:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-24-2013
05:43 PM

01-24-2013
05:43 PM

Re: fit xy-dataset with minerr in a loop

Turn the solve block into a function, and call the function in a loop.

If you are minimizing a vector of residuals make sure mineer is using the LM algorithm.

Top Tags