How to calculate the area of a fit curve?

3 vues (au cours des 30 derniers jours)
Fc Fc
Fc Fc le 1 Mai 2018
Commenté : Ameer Hamza le 2 Mai 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

Réponse acceptée

Ameer Hamza
Ameer Hamza le 1 Mai 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 commentaires
Fc Fc
Fc Fc le 2 Mai 2018
Thank you! it worked!
Ameer Hamza
Ameer Hamza le 2 Mai 2018
You are welcome.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by