Você está na página 1de 4

Heaven’s Light is Our Guide

RAJSHAHI UNIVERSITY OF ENGINEERING & TECHNOLOGY

Experiment No: 4

Experiment Name:

Using some commands on polynomial equations by Matlab.

Submitted By:

Name : Ahmed Sobhan Abir

Roll : 145011

Dept : IPE

Course No: IPE 4108


Experiment No: 4
Name of the Experiment:
Using some commands on polynomial equations by Matlab.

1.Roots of polynomial
𝑥 5 - 7𝑥 3 + 4𝑥 2 +x-10
Command window
>> x= [1 0 -7 4 1 -10];
>> roots (x)
ans =
2.4252 + 0.0000i
-2.8010 + 0.0000i
0.7090 + 0.9537i
0.7090 - 0.9537i
-1.0423 + 0.0000i

2.Construct polynomial from roots


Roots are 7,9 10
Command window
>> r= [7 9 10];
>> poly(r)
ans =
1 -26 223 -630

3.Polynomial Differentiation
𝐱 𝟑 +10x+10
Command window
>> syms x;
>> func= x^3+10*x+10;
>> diff(func,x)
ans =
3*x^2 + 10

4.Value of a polynomial at a certain point


Command window
>> p=[4 -6 5 -7 9 10];
>>x=-11;
>>polyval(p,x)
ans =
-739641
5.Multiplication of two polynomials
Command window
>>a=[0 1 0 7 5 9 39];
>>b=[12 0 -8 0 4 0 32];
>>conv(a,b)
Columns 1 through 8
0 12 0 76 60 56 428 -12
Columns 9 through 13
-292 260 316 288 1248

6.Dividation of two polynomials


Command window
>> B=[1 0 -4 -4 -16 -8 -21 -28];
>> A=[1 2 0 3 4];
>> [Q R]=deconv(B,A)
Q=
1 -2 0 -7
R=
0 0 0 0 0 0 0 0

7.Trapezoidal rule
3
1

1 x2
Command window
>> y=(1./(x.^2));
>> x=linspace(1,3,8);
>> y=(1./(x.^2));
>> trapz(x,y)
ans =
0.6796

8.Simpson rule
3
1

1 x2

Command window
>> syms x;
>> area =int(1./(x.^2),1,3)
area =
2/3

Você também pode gostar