How can I fit a curve where integration of a function is involved?
Mostrar comentarios más antiguos
My function is like f1 = integral(@(x1)fun(x1,A,B),0,1000); where "fun" has a exponential term and a "ln" term. A,B are constants which would come out after fitting the curve Is there any way to put this equation in matlab curve fitting tools? If it is possible then how can i call the function "fun"?
2 comentarios
Star Strider
el 7 de Mzo. de 2016
What precisely are you doing?
What are your independent and dependent variables with respect to ‘f1’?
Are you fitting ‘A’ and ‘B’?
SWAGATA BHUNIA
el 8 de Mzo. de 2016
Respuestas (3)
Torsten
el 8 de Mzo. de 2016
function fitting
xdata = [...];
ydata = [...];
fun=@(x,xdata,A,B)exp(-A*x.^2.*log(B+x)).*cos(xdata*x);
fun2=@(y)integral(@(x)fun(x,xdata,y(1),y(2)),0,1000,'ArrayValued',true);
y0=[1 1];
y = lsqcurvefit(fun2,y0,xdata,ydata)
Best wishes
Torsten.
SWAGATA BHUNIA
el 10 de Mzo. de 2016
0 votos
Add the lines
ydata_sim = fun2(y);
plot(xdata,ydata,xdata,ydata_sim)
at the end of the code.
Best wishes
Torsten.
Categorías
Más información sobre Get Started with Curve Fitting Toolbox 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!