필터 지우기
필터 지우기

Why my integration is like this?

조회 수: 2 (최근 30일)
Faezeh Manesh
Faezeh Manesh 2019년 10월 9일
댓글: Fabio Freschi 2019년 10월 10일
Hello everyone,
Actually, I have some data from my experiment which is as follows:
dsc.jpg
I am trying to integrate the above curve. So, I fitted a curve to this (using multiple gaussian terms in cftool) and used the resulted function to integrate my data as follows:
clc
clear all
%result of the cftool for 5 gaussian fit to the experimental data
syms f(x)
f(x)= (0.05644*exp(-((x-65.1)/2.813).^2))+(0.08694*exp(-((x-63.1)/1.605).^2))+(0.07148*exp(-((x-61.7)/1.085).^2))+...
(0.03588*exp(-((x-69.23)/5.666).^2));
%integrate the above function
f7 = int(f,x)
% reading my experimental data
[d,s,r] = xlsread('DSCtest.csv');
T = d(:,1);
y = f7(T);
y2=double(y);
plot(T, f7(T))
Then, I plotted the resulted curve (result of integral) and the original curve at a same sheet. But the result doesn't make sense. Because, as you can see,at the beggining of the blue curve ( until x=60) y is zero and the integral should be zero too. while the integral becomes negative here. Do you know what is going on here?
I have also attached my experimental data here.
hit_dsc.jpg
  댓글 수: 3
Faezeh Manesh
Faezeh Manesh 2019년 10월 9일
But it is not -0.4
Walter Roberson
Walter Roberson 2019년 10월 10일
Your claim was that the integral should be 0 between 0 and 60.

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

답변 (1개)

Fabio Freschi
Fabio Freschi 2019년 10월 9일
You are calulating an indefinte integral that has an integration constant by definition. Matlab int command doesn't add the integration constant, so your solution could be translated. If you integrated numerically, you will see the same "shape" of your solution, only translated:
I = cumtrapz(d(:,1),d(:,2));
figure,plot(d(:,1),I);
  댓글 수: 3
Walter Roberson
Walter Roberson 2019년 10월 10일
syms b x
simplify(subs(int(f,x),x,b) - int(f,0,b))
ans =
-(pi^(1/2)*(3877790*erf(12340/217) + 6976935*erf(12620/321) + 10164804*erf(34615/2833) + 7938286*erf(65100/2813)))/100000000
double(ans)
-0.513263907105595
Therefore Fabio's suggestion that you have an issue involving the constant of integration is correct.
Fabio Freschi
Fabio Freschi 2019년 10월 10일
cumtrapz gives you a "point to point integration" and it is rather smooth, because you have a fine sampling of your original data. Try to run the two lines after you read the experimental data (copied here for your convenience)
I = cumtrapz(d(:,1),d(:,2));
figure,plot(d(:,1),I);

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

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by