Assignment No.3: 1.12 Exercises
Assignment No.3: 1.12 Exercises
3
1.12 Exercises
QUESTION:1
Use MATLAB to compute the roots of the following polynomials:
(a)
p(x)=x.^3+8*x.^2+10*x+4
p=[1 8 10 4]
p=
10
19
25
16
r1 =
-6.5708
poly_r1=poly(r1)
poly_r1 =
1.0000 8.0000 9.9997
P(x)=x^3+8x^2+10x+4
4.0000
r2=[-2 -2 -3 -3 -3]
r2 =
-2 -2
-3
-3
-3
poly_r2=poly(r2)
poly_r2 =
1 13 67 171 216 108
P(x)=x^5+13x^4+67x^3+171x^2+216x+108
QUESTION:3
Use MATLAB to evaluate the polynomials below at the specified values:
(a)
p(x)=x.^3+8*x.^2+10*x+4
p=[1 8 10 4]
p=
1
10
value=polyval(p,1.25)
value =
30.9531
(b)
p(y)=y.^5+7*y.^4+19*y.^3+25*y.^2+16*y+4
p=[1 7 19 25 16 4]
p=
1
19
25
16
value=polyval(p,-3.75)
value =
-63.6904
Exercises
1THE END