How to calculate the area of a fit curve?

3 visualizaciones (últimos 30 días)
Fc Fc
Fc Fc el 1 de Mayo de 2018
Comentada: Ameer Hamza el 2 de Mayo de 2018
Hi, I must calculate the area of 4 fit curves.
I wrote:
myfitga1_P1P2graf= fit(eVc.',ckgran.','a1_P1graf*exp(-((x-285)/c1_P1graf)^2)+a1_P2graf*exp(-((x-287.8)/c1_P2graf)^2)','StartPoint',[start_point start_point start_point start_point]);
myfitga1_P1P2P3graf= fit(eVc.',ckgran.','a1_P1graf*exp(-((x-285)/c1_P1graf)^2)+a1_P2graf*exp(-((x-287.8)/c1_P2graf)^2+a1_P3graf*exp(-((x-292.2)/c1_P3)^2))','StartPoint',[start_point start_point start_point start_point start_point start_point]);
syms eVc;
AreaP1P2graf=int(myfitga1_P1P2graf,eVc,emin,emax);
AreaP1P2P3graf=int(myfitga1_P1P2P3graf,eVc,emin,emax);
myfitga1_P1P2= fit(eVc.',ckxfit.','a1_P1*exp(-((x-285)/c1_P1)^2)+a1_P2*exp(-((x-287.8)/c1_P2)^2)','StartPoint',[start_point start_point start_point start_point]);
myfitga1_P1P2P3= fit(eVc.',ckxfit.','a1_P1*exp(-((x-285)/c1_P1)^2)+a1_P2*exp(-((x-287.8)/c1_P2)^2+a1_P3*exp(-((x-292.2)/c1_P3)^2))','StartPoint',[start_point start_point start_point start_point start_point start_point]);
AreaP1P2=int(myfitga1_P1P2,eVc,emin,emax);
AreaP1P2P3=int(myfitga1_P1P2P3,eVc,emin,emax);
but I get this error:
Undefined function 'int' for input arguments of type 'cfit'.
How to fix it? Best regards

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 1 de Mayo de 2018
You are getting the error because int object only accept symbolic expressions where fit() function returns a cfit object. To integrate the cfit object, thre is no need to use syms, use curve fittinng toolbox function integrate as follow
AreaP1P2graf = integrate(myfitga1_P1P2graf ,emin, emax);
  2 comentarios
Fc Fc
Fc Fc el 2 de Mayo de 2018
Thank you! it worked!
Ameer Hamza
Ameer Hamza el 2 de Mayo de 2018
You are welcome.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by