In: Physics
Consider the following polynomial
?(?)=(?+2)(?−10)(?+4)(?−2)
a)Use Matlab to multiply these terms in order to form a 4thorder polynomial
b)Apply the ‘roots’ function to your answer in part a to verify your calculation was correct.
c)Use Matlab to divide your polynomial answer in part aby the term (s+2
)d)Apply ‘roots’ to your answer in part c to verify your calculation was correct.
a)
syms s
d=s-2;
c=s+2;
b=s+4;
a=s-10;
p= expand(a*b*c*d)
disp("This is the 4th order function")
Output -
p =
s^4 - 6*s^3 - 44*s^2 + 24*s + 160
b)
P=[1 -6 -44 24 160];
disp("The roots are")
r=roots(P)
Output -
The roots are
r =
10.0000
2.0000
-4.0000
-2.0000
c)
syms s
p=(s^4)-6*(s^3)-44*(s^2)+24*s+160;
d=(s+2);
vars=[s];
[r,q]= polynomialReduce(p,d,vars)
disp("This is the reduced polynomial")
Output -
r =
0
q =
s^3 - 8*s^2 - 28*s + 80
This is the reduced polynomial
Here denotes the remainder and q the quotient that is the reduced polynomial.
d)
q=[1 -8 -28 80]
R=roots(q)
disp("Hence the same roots are obtained")
Output -
R =
10.0000
-4.0000
2.0000
Hence the same roots are obtained
I hope my answer helps. Have a nice day