Combining fsolve and lsqcurvefit
2 views (last 30 days)
Show older comments
Good evening,
I have a collection of experimental data (xi, yi) called (texp, rexp). I know that 'texp' must be derived from 'rexp' following:
t(i)=k(1)*integral(@(x) exp(-k(2)./(x.*log(x))), 1, r(i))
, being k(1) and k(2) parameters. So 'r(i)' is the upper integration limit. I need to find the values of k(1) and k(2) that best fits my model. My strategy is solving the equations 't(i)-texp=0' in 'r' with fsolve and fitting k(1) and k(2) with lsqcurvefit. I am trying this:
rteor=@(k,r) fsolve(@(r) arrayfun(@(T) k(1).*integral(@(x) exp(-k(2)./(x.*log(x))), 1, r)-T, texp), 1.0001);
x0=[2,6.12750];
k = lsqcurvefit(rteor, x0, texp, rexp)
which results on the following errors:
Error using lsqcurvefit (line 251)
Function value and YDATA sizes are not equal.
Thank you for your help!
6 Comments
Answers (0)
See Also
Categories
Find more on Systems of Nonlinear Equations 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!