Differentiating a function and finding critical points

조회 수: 7 (최근 30일)
Will
Will 2014년 2월 28일
편집: Mischa Kim 2014년 2월 28일
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.

채택된 답변

Mischa Kim
Mischa Kim 2014년 2월 28일
편집: Mischa Kim 2014년 2월 28일
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

추가 답변 (0개)

카테고리

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