Different result by hand-differentiaion vs MATLAB diff() function.

I differentiated the equation, ( K=(y^2 + 2*y + 2)/(y + 1)^2 ), by hand-differentiation and got result, ( -2/(y+1) ) while the result with MATLAB function, ( diff(K, y) ) was, (2*y + 2)/(y + 1)^2 - (2*(y^2 + 2*y + 2))/(y + 1)^3
I don't know why was it and what was the wrong I did.
Please help. Thank you.

 Akzeptierte Antwort

Roger Stafford
Roger Stafford am 5 Mär. 2018
Bearbeitet: Roger Stafford am 5 Mär. 2018

0 Stimmen

Your "hand-differentiation" is not correct! The 'diff' answer is correct but can be simplified to an equivalent -2/(y+1)^3. (Perhaps the latter is what you meant to write?)

5 Kommentare

Hi Mr. Roger Stafford, Thank you for your answer. But I followed the procedure described in the
'Solutions Manual - Control Systems Engineering by Norman S. Nise ed 6.pdf'
and got the same result ( please refer to the attached file, image1.jpg, for reference.
That is why I cannot understand. Please help. Thanks again.
Here is the differentiation computation:
K = (y^2 + 2*y + 2)/(y + 1)^2
dK/dy = (d(y^2 + 2*y + 2)/dy)/(y+1)^2 + (d((y+1)^-2)/dy)*(y^2 + 2*y + 2)
= (2*y+2)/(y+1)^2 - 2*((y+1)^-3)*(y^2 + 2*y + 2)
= ((2*y+2)*(y+1)-2*(y^2 + 2*y + 2))/(y+1)^3
= ((2*y^2+4*y+2)-(2*y^2+4*y+4)) / (y+1)^3
= -2/(y+1)^3
Somehow you lost the cube power in that y+1 denominator.
yf's "Answer" moved here:
Hi Mr. Roger Stafford,
Thank you for your answer. I will think about it why is the different result in between the book and from the MATLAB. Thanks once again.
@yf: considering that Roger Stafford helped you to resolve this issue then you should accept this answer: this is the easiest way for you to show your appreciation to the volunteers who help you on this forum.
yf's "Answer" moved here:
Hi Mr. Roger Stafford,
I found the problem now. the denominator in the solution manual is actually,
(y^2 + 2*y + 1)^2 = ( (y + 1)^2 )^2
hence is,
(2*y + 2)/(y + 1)^2 - (2*(y^2 + 2*y + 2))/(y + 1)^3 = -2*(y + 1)/(y+1)^4 = -2/(y+1)^3
I made mistake on this point.
Thank you so much for you answer and help.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange

Gefragt:

yf
am 5 Mär. 2018

Kommentiert:

am 5 Mär. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by