Lsqcurvefit on function depending on syms
Mostrar comentarios más antiguos
Hi.
I'm using the int command to integrate a huge expression, using syms. The expression is saved in a variable "funk". In funk is a constant that I need to determine by fitting "funk" to my experimental data. For this I have tried to use lsqcurvefit, but I can't get this to work by simple putting "funk" in the expression where the function is suppose to be written. This is how it looks:
funk=huge expression with syms x
xdata=..
ydata=..
lsqcurvefit(@(x,xdata) funk, [some value] ,xdata,ydata)
How can I do this? Please help!
Respuesta aceptada
Más respuestas (2)
Gustav
el 12 de Mzo. de 2012
0 votos
1 comentario
Seth DeLand
el 13 de Mzo. de 2012
Because funk is already a function handle (that's what matlabFunction created), you don't need to use the @(d,t) syntax when passing it to lsqcurvefit. You can just pass funk:
d = lsqcurvefit(funk,7,t,ydata)
Gustav
el 16 de Mzo. de 2012
0 votos
Categorías
Más información sobre Calculus en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!