The way to integrate a differentiated function(微分した関数を積分する方法)
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Daniel Pollard
le 15 Déc 2020
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 commentaires
Daniel Pollard
le 15 Déc 2020
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?
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!