Curve fitting with lsqcurvefit (2 curves simultaneously)

9 views (last 30 days)
Hello.
I need to adjust a few parameters x1, x2, .., xn of two different functions f1 and f2 simultaneously to some experimental data. When using lsqcurvefit, I can only fit parameters of a single function. I've actually solved my problem by creating a function f = f1+f2 and adjusting the parameters so f fits the sum of the points obtained experimentally for each function. I think there might be a better way to do that, since my results aren't good yet. What would you suggest? I've also tried to use fminsearch to minimize the residual using the least squares method, but it didn't work.
Thanks in advance.

Accepted Answer

Matt J
Matt J on 10 Jun 2013
Edited: Matt J on 10 Jun 2013
When using lsqcurvefit, I can only fit parameters of a single function.
Why? You do know that the output of F(x,xdata) can be vector/matrix valued, right? The only requirement from the documentation is
"ydata must be the same size as the vector (or matrix) F returned by fun."

More Answers (0)

Community Treasure Hunt

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

Start Hunting!