Plot the following equation using MATLAB

Plot the following equation using matlab
Plot Y=3x³-26x+10 -2<=x<=4
Interval and its first and second derivative , all in the same plot

2 件のコメント

KSSV
KSSV 2020 年 11 月 2 日
What have you tried for this home work?
Amruta Jadhav
Amruta Jadhav 2020 年 11 月 2 日
移動済み: Walter Roberson 2025 年 2 月 26 日
Yes I had tried
syms t
Y=3x³-26x+10;
X = -2;
X=4
ezplot(x, y)

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

回答 (1 件)

Walter Roberson
Walter Roberson 2025 年 2 月 23 日

0 投票

Y=3x³-26x+10
MATLAB has no implied multiplication anywhere. You cannot use, for example, 26x and have that be understood. You need to put in explicit multiplication.
The main multiplication operator in MATLAB is the .* operator, which is element-by-element multiplication. MATLAB also has the * operator, which is primarily intended for algebraic matrix multiplication -- but the forms ARRAY*SCALAR and SCALAR*ARRAY are both understood instead of having to use ARRAY.*SCALAR or SCALAR.*ARRAY
MATLAB does not understand superscript ³ or ² or the like as indicating exponentiation. Instead, you need to use a power operator. The main power operator in MATLAB is the .^ operator, which is element-by-element power. MATLAB also has the ^ operator, which is primarily intended for algebraic matrix power.
Now, when you are doing symbolic work, the derivative operator is named diff
Putting these together:
range = [-1 2];
syms x
Y = 2.*x.^4 - 5.*x.^3 + sin(x)
Y = 
dY = diff(Y);
d2Y = diff(dY);
fplot([Y, dY, d2Y], range)

カテゴリ

質問済み:

2020 年 11 月 2 日

移動済み:

2025 年 2 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by