How to calculate the area of a fit curve?

3 次查看(过去 30 天)
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

采纳的回答

Ameer Hamza
Ameer Hamza 2018-5-1
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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by