# Using leasqr to fit experimental data. Question about weighing

6 messages
Open this post in threaded view
|

## Using leasqr to fit experimental data. Question about weighing

 Hey guys & girls, I found a script on the net that uses leasqr to fit experimental data to a function and adapted it to my needs. Works like a charm =) I do still have some trouble with understanding/using the weighing properly and hoped maybe someone could help me out. Here is my situation: I have experimental x-y data, the process is roughly an exponential decay. As always with real life data, its noisy and especially in the tail of the exponential, the noise is a problem. I know the absolute size of noise, let's call this number "noize". What I am used to doing in experimental data fitting is to take the weighing factor for each y-point as the inverse of its relative error, i.e. noize/yvalue. But the "wt" used in leasqr has to be an N*N-matrix, where N is the number of y-values ... I am a bit confused as to how I would construct the proper wt-matrix for the problem at hand. Help would be much appreciated, thanks in advance, Timo ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct_______________________________________________ Octave-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/octave-dev
Open this post in threaded view
|

## Re: Using leasqr to fit experimental data. Question about weighing

 Hi Timo,As far as I can tell from the documentation ( http://octave.sourceforge.net/optim/function/leasqr.html ), wt is an N*1 vector. If your estimated error standard deviation is constant and equal to noize, you would set wt = ones(n, 1) / noize Nir ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct_______________________________________________ Octave-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/octave-dev
Open this post in threaded view
|

## Re: Using leasqr to fit experimental data. Question about weighing

 That works indeed, cheers Nir! I was confused because by default, wt is set to ones(size(y)) ... also from the documentation - which kind of clashed with the initial statement, that wt should be of the same dimension as y ... Anyways, thanks for the quick reply, I consider my problem fixed. Timo 2012/10/17 Nir Krakauer <[hidden email]>: > Hi Timo, > > As far as I can tell from the documentation ( > http://octave.sourceforge.net/optim/function/leasqr.html ), wt is an N*1 > vector. If your estimated error standard deviation is constant and equal to > noize, you would set wt = ones(n, 1) / noize > > Nir ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct_______________________________________________ Octave-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/octave-dev
Open this post in threaded view
|