The way to integrate a differentiated function(微分した関数を積分する方法)
1 回表示 (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
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 件のコメント
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 Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!