Determining where y = 0

9 ビュー (過去 30 日間)
Duncan Weakley
Duncan Weakley 2020 年 12 月 3 日
コメント済み: Duncan Weakley 2020 年 12 月 3 日
Hi there, I have a function f(x) and need to determine where f(x) is increasing and decreasing
So I determined the derivitive of f(x) as Df.
I need to get the values of x where y=0 of Df to 4 decimal places.
I am asking if someone could help me.
  1. To get the points where Df(x) = 0
  2. To get these values rounded to 4 decimal spaces
This is the graph of Df
Code i used to get here:
syms f(x)
f(x) = x.*(cos(x.^2)) - exp(sqrt(x)) + x.^3 - 4*(x.^2);
Df = diff(f,x);
fplot(Df, [0 4], 'b')
grid on
xlim([0.00 4.00])
ylim([0.0 27.3])

採用された回答

KSSV
KSSV 2020 年 12 月 3 日
Try this:
syms f(x)
f(x) = x.*(cos(x.^2)) - exp(sqrt(x)) + x.^3 - 4*(x.^2);
Df = diff(f,x);
y = subs(Df,x,0:0.001:4) ; % this should be an array
idx = abs(y)<=10^-3 ;
iwant = y(idx) ;
fplot(Df, [0 4], 'b')
grid on
xlim([0.00 4.00])
ylim([0.0 27.3])
  5 件のコメント
Duncan Weakley
Duncan Weakley 2020 年 12 月 3 日
i did this, but the live editor has been running for 15 minutes without output, think its to much to handle...
i resolved the issue by using chebfun:
Duncan Weakley
Duncan Weakley 2020 年 12 月 3 日
although i still get that weird warning... i only needed the roots in the interval [0 4], so i got what i needed thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by