Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Re: Non linear fit with more than 2 dimensions!, does mpfit work?
On Thursday, April 12, 2012 12:57:04 AM UTC-4, Steve Daal wrote: > IDL-ers, > > I have a complex fitting problem that I am tackling. my model function > has the form: > > Y(n+1) = A(1 - exp(C*Yn)) * [X(n+1)/exp(D-Xn - Yn)] > > where Yn and Xn refer to some values at time= n, and Y(n+1), X(n+1) > refer to updated values at time =n+1. A,B,C, and D are the parameters > of the fit. > > I am aware of mpfit and I think this is doable if I have Yn and Xn > only, but I am really puzzled with the existence of the n+1 terms. The answer is that MPFIT doesn't care about the dimensionality of the problem. It just wants a list of residuals to minimize. That goes for the dimensionality of both your *de*pendent and *in*dependent variables. It's not clear if you want to do a new fit, every time a new N+1 data set arrives. Or, if you want to do a global fit of all data points at once. It sounds like you may need to do a FOR loop to evaluate your function. So be it. First focus on getting a correct answer, then worry about speed later. Craig
On Apr 12, 7:45 am, Craig Markwardt <craig.markwa...@gmail.com> wrote: > On Thursday, April 12, 2012 12:57:04 AM UTC-4, Steve Daal wrote: >> IDL-ers, > >> I have a complex fitting problem that I am tackling. my model function >> has the form: > >> Y(n+1) = A(1 - exp(C*Yn)) * [X(n+1)/exp(D-Xn - Yn)] > >> where Yn and Xn refer to some values at time= n, and Y(n+1), X(n+1) >> refer to updated values at time =n+1. A,B,C, and D are the parameters >> of the fit. > >> I am aware of mpfit and I think this is doable if I have Yn and Xn >> only, but I am really puzzled with the existence of the n+1 terms. > > The answer is that MPFIT doesn't care about the dimensionality of the problem. It just wants a list of residuals to minimize. That goes for the dimensionality of both your *de*pendent and *in*dependent variables. > > It's not clear if you want to do a new fit, every time a new N+1 data set arrives. Or, if you want to do a global fit of all data points at once. > > It sounds like you may need to do a FOR loop to evaluate your function. So be it. First focus on getting a correct answer, then worry about speed later. > > Craig Great, Thanks Craig!