using lsqcurvefit with normalized error

7 visualizaciones (últimos 30 días)
minu pilvankar
minu pilvankar el 11 de Sept. de 2019
Comentada: minu pilvankar el 11 de Sept. de 2019
Hello,
I am using lsqcurvefit to fit a data set . However, the data points (ydata) I have has a very wide range (10^-3 to 10^3). So, when the lsqcurvefit tries to minimize the squared error, it minimizes it for the initialdata points (of higher values of ydata) and then gives a bad fit as we move ahead (to lower values of ydata). I tried using fmincon instead of lsqcurvefit and wrote a function (similar to lsqcurevfit) to minimize the error. But I modified this function by normalizing each error with the data point so that each data point gets similar weightage (be of higher or lower magnitude). This way I get a good fit but then I cannot plot the 95% confidence interval. So i am going back to lsqcurvefit. Is there a way to use lsqcurvefit that can normalize the error at each data point and give better fit? or can I plot the 95% confidence interval with fmincon?

Respuesta aceptada

Matt J
Matt J el 11 de Sept. de 2019
Editada: Matt J el 11 de Sept. de 2019
This way I get a good fit but then I cannot plot the 95% confidence interval.
fmincon doesn't return the Jacobian, but it does return the Hessian, which you can use in a similar way to compute confidence intervals.
Is there a way to use lsqcurvefit that can normalize the error at each data point and give better fit?
Yes, if F(x,xdata) is your model function, then call lsqcurvefit as,
lsqcurvefit(@(x,xdata) F(x,xdata)./ydata, x0, xdata, ones(size(ydata)) );

Más respuestas (0)

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by