Differentiating a function and finding critical points
조회 수: 7 (최근 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!