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일
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