cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

fit xy-dataset with minerr in a loop

urot
1-Visitor

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

3 REPLIES 3
Werner_E
25-Diamond I
(To:urot)

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.

Fred_Kohlhepp
23-Emerald I
(To:urot)

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

RichardJ
19-Tanzanite
(To:urot)

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.

Announcements

Top Tags