How to fit a custom function using nlinfit?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have written a function 'fun' in a separate .m file that I would like to fit to some xy data, using a parameter 'A' as a fitting parameter. However, since the function depends on the input of xdata and the parameter A to run, I am no sure how to fit it using nlinfit (or similar). When I enter the following, matlab returns an error:
nlinfit(xdata,ydata,fun,A)
Error in fun(line 13)
Not enough input arguments.
So apparently, the xdata and A do not end up like this:
fun(xdata,A)
Does anybody know how to fit a function that was not defined using a function handle?
Thanks in advance!
2 comentarios
Image Analyst
el 11 de Dic. de 2017
Please attach your data and tell us the model you wish to fit to it. In the meantime, I've attached 3 demos that perhaps can be adapted to your situation.
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!