How to fit a linear function in two variables?
Show older comments
Hi,
I am trying to fit a simple superposition function between three arrays - Y[ ]=a*X1[ ]+b*X2[ ] to determine the best fit using two numbers a and b.
I have tried manually varying the values of a and b (to get the sum to be closest to Y) though I would like to obtain exact values and some sense of the error.
I have tried using some of the functions like lsqcurvefit and lsqlin though I have not been able to figure out a way to vary two constants at once.
I would really appreciate if someone could share some ideas to solve such a problem. Thank you!
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!