Differentiating a function and finding critical points
8 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!