I have 3 variables y, x1, and x2 stored in vector form. I know that y=f(x1,x2) and has the form y = a*b*x1/(1+b*x1+c*x2) + d*x1. a,b,c, and d are parameters. How can I use lsqnonlin to find a,b,c,d?
A low quality fit can have two reasons, either the algorithm failed or the data is too noisy. I don't know how sensitive lsqnonlin is to initial values, but it is possible you ended up with a local minimum.
You could try with a different fitting function or with different initial guesses. Those two will only help if your function properly describes the trend in your data and if your data isn't noisy in the first place.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
5 Comments
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/507593-using-least-square-fit-to-find-the-best-fit-parameters#comment_802393
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/507593-using-least-square-fit-to-find-the-best-fit-parameters#comment_802393
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/507593-using-least-square-fit-to-find-the-best-fit-parameters#comment_802400
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/507593-using-least-square-fit-to-find-the-best-fit-parameters#comment_802400
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/507593-using-least-square-fit-to-find-the-best-fit-parameters#comment_802404
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/507593-using-least-square-fit-to-find-the-best-fit-parameters#comment_802404
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/507593-using-least-square-fit-to-find-the-best-fit-parameters#comment_802407
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/507593-using-least-square-fit-to-find-the-best-fit-parameters#comment_802407
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/507593-using-least-square-fit-to-find-the-best-fit-parameters#comment_802416
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/507593-using-least-square-fit-to-find-the-best-fit-parameters#comment_802416
Sign in to comment.