The way to integrate a differentiated function(微分した関数を積分する方法)

조회 수: 2 (최근 30일)
Yoshiki Sato
Yoshiki Sato 2020년 12월 15일
댓글: Daniel Pollard 2020년 12월 15일
I would like to know the way to integrate a differentiated function.
Specifically, I want a calculation like this.
y=x^2+x+5
diff(y)=2x+1
integral(diff(y) ,0 ,1)=2
I tried some ways, but they were not success.
I show the ways I tried.
ex.1
>> y=@(x) x.^2+x+5
y =
function_handle with value:
@(x)x.^2+x+5
>> diff(y)
Undefined function 'diff' for input arguments of type 'function_handle'.
ex.2
>> syms x;
>> y=x.^2+x+5
y =
x^2 + x + 5
>> diff(y)
ans =
2*x + 1
>> yy=@(x) diff(y)
yy =
function_handle with value:
@(x)diff(y)
>> integral(yy,0,1)
Error using integralCalc/finalInputChecks (line 522)
Input function must return 'double' or 'single' values. Found 'sym'.
Error in integralCalc/iterateScalarValued (line 315)
finalInputChecks(x,fx);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Do you have any ways? Please teach me...
Thank you.

답변 (1개)

Daniel Pollard
Daniel Pollard 2020년 12월 15일
Well the integral of a derivative is simply the function itself. For example:
y(x) = x^2 + x + 5
dy/dx = 2x + 1
integral(dy/dx) = x^2 + x + 5 + c
integral(dy/dx from 0 to 1) = y(1) - y(0).
In your case, you have already defined y(x), so you can just use that.
  댓글 수: 2
Yoshiki Sato
Yoshiki Sato 2020년 12월 15일
Thank you for your support.
I know that you said.
Actually, I would like to use two differentiated functions, y1'(x) and y2'(x).
And, I want to integrate the function defined by y1'(x) * y2'(x) .
To explain simply, I used simple example.
Thank you.
Daniel Pollard
Daniel Pollard 2020년 12월 15일
I haven't used the symbolic toolbox before so this is getting a bit out of my knowledge. Do you know the functions beforehand, so maybe you could integrate y1'*y2' using integration by parts, or explicitely define the product in matlab and use a symbolic integration command?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by