using lsqcurvefit with normalized error
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Nonlinear Least Squares (Curve Fitting) in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!