How to get back the values of a curve from its cumulative integral value?

조회 수: 1 (최근 30일)
AS
AS 2021년 4월 5일
댓글: AS 2021년 4월 7일
I have a amplitude distribution with time ( i.e. real curve, blak line). Then I did cumulative trapezoidal inegration of the curve using cumtrapz, which is represented by blue curve. Now, I again retain the real curve i.e. black curve from its cumulative integration i.e. blue curve. How I will get the real curve? Please provide me the suggestions. Thanks in advance.

채택된 답변

darova
darova 2021년 4월 5일
Use diff to find real curve from cumulative trapezoid result
  댓글 수: 6
darova
darova 2021년 4월 7일
Works ok for me
clc,clear
y = load('data.txt');
x = 1:length(y);
inty = cumtrapz(x,y);
y1 = diff(inty)./diff(x);
plot(x,y,'r')
line(x,inty,'color','k','linestyle','--')
line(x(2:end),y1)
legend('original','returned')
AS
AS 2021년 4월 7일
Thank you so much. I did mistake in length of the data. Now it is appropiate. Thanks a lot.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by