Using lsqcurvefit with a function that contains a for loop
2 views (last 30 days)
Show older comments
I want to fit Fick's Law for diffusion in a sphere using lsqcurvefit to experimental data.
The equation is an infinite series of the form
y = 1- sum((A/n^2 * exp(-B*n^2*t - t0))
I would like to create a function which sums the first 100 n terms using a for loop and then use lsqcurvefit to adjust parameter B to fit the experimental mass versus time data.
I know how to use lsqcurvefit, I just want to know how to fit this equation without adding the first 100 etc terms manually in the function file.
Thanks for your help,
Jon
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!