Differentiating a function and finding critical points

8 views (last 30 days)
I have been set a problem and managed to complete the first part which was to plot the function:
y= t^6-4*t^4-2*t^3+3*t^2+2*t
This was done in the Editor as a script: %script file to plot (y =f(t)= t^6-4*t^4-2*t^3+3*t^2+2*t) %interval [-3/2:5/2] t =[-3/2:0.01:5/2]; y=t.^6-4*t.^4-2*t.^3+3*t.^2+2.*t; plot (t,y)
But now I have to differentiate this function to find where f'(t) = 0...
In the command window, I typed diff(y), which gives a list of values. However, I am not sure how to use fzero to find the critical points.

Accepted Answer

Mischa Kim
Mischa Kim on 28 Feb 2014
Edited: Mischa Kim on 28 Feb 2014
Will, you could work symbolically to get the job done:
syms y t
y = t^6 - 4*t^4 - 2*t^3 + 3*t^2 + 2*t;
dy = diff(y,t)
dy =
6*t^5 - 16*t^3 - 6*t^2 + 6*t + 2
rootsdy = double(solve(dy == 0))
rootsdy =
-1.000000000000000
-1.000000000000000
1.684694738462017
0.629578614136595
-0.314273352598613
ezplot(y,[-1 2])
grid

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!