Improve least squares solution
Show older comments
I have to solve a least squares problem in which y=Ax, where y is a vector whose entries are experimental data, A is my model and x is the solution I need to find so as to weight properly my model to fit the experiments. The following figure shows in blue the experimental data (y) and in red Ax.

How could I obtain a better fit for my data in MATLAB? Is there any specific function for this? (I am not sure how to use the nonlinear least squares method, I simply solved the normal equations with the backslash \ )
3 Comments
Aquatris
on 17 Jul 2018
Your question is hard to answer if you do not give more information. What type of experiment is this? Do you know what the equation should look like? Are you sure you derived your A matrix correctly? Does your measurements have significant noise? What is the condition number of A matrix?
carlos g
on 17 Jul 2018
dpb
on 17 Jul 2018
You're apparently trying to use an extremely high-order polynomial to fit a very difficult problem.
The solution is undoubtedly to find a more suitable model.
The backslash operator is quite sophisticated despite its deceptively simple syntax; internally it does quite sophisticated stuff and generally outperforms any other technique for badly condition systems.
Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!