필터 지우기
필터 지우기

How to calculate the area of a fit curve?

조회 수: 2 (최근 30일)
Fc Fc
Fc Fc 2018년 5월 1일
댓글: Ameer Hamza 2018년 5월 2일
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);
  댓글 수: 2
Fc Fc
Fc Fc 2018년 5월 2일
Thank you! it worked!
Ameer Hamza
Ameer Hamza 2018년 5월 2일
You are welcome.

댓글을 달려면 로그인하십시오.

추가 답변 (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