Você está na página 1de 11

# Exercise 1

Coding :
'Ex'
'How are you?'
-3.96
-4+7i
-5-6j
(-4+7i)+(-5-6i)
(-4+7j)*(-5-6j)
M=5
N=6
P=M+N

Result :
ans =
Ex
ans =
How are you?
ans =
-3.9600
ans =
-4.0000 + 7.0000i
ans =
-5.0000 - 6.0000i
ans =
-9.0000 + 1.0000i
ans =
62.0000 -11.0000i
M=
5

%Display label
%Display string
%Display scalar no -3.69
%Diaplay complex no -4+7i
%Dispaly complax no -5-6j
%Add two complex nnumber and display sum
%Multiply two complex number and display product
%Assign 5 to M and display
%Assign 6 to N and display
%Assign M+n to P and display

N=
6
P=
11

Exercise 2
Coding :
'Ex 2'
P1=[1 7 -3 23]

%Display label
%Store poloynomial s^3+7s^2-3s+23 as P1 and display

Result :
ans =
Ex 2
P1 =
1

-3

23

Exercise 3
Coding :
'Ex3'
P2=[3 5 7 8];
3*5

Result :
ans =
Ex3
ans =
15

%Display label
%Assign 3s^3+5s^2+7s+8 to P2 without displaying
%Evaluate 3*5 and display result

Exercise 4
Coding :
'Ex4'
P3=poly([-2 -5 -6])
the coefficients

%Display label
%Store polynomial (s+2)(s+5)(s+6) as P3 and display

Result :
ans =
Ex4
P3 =
1

13

52

60

Exercise 5
Coding :
'Ex 5'
P4=[5 7 9 -3 2]
rootsP4=roots (P4)

%Display label.
%Form 5s^4+7s^3+9s^2-3s+2 and display.
%Find roots of 5s^4+7s^3+9s^2-3s+2, assign to roots
P4 and display

Result :
ans =
Ex 5
P4 =
5

rootsP4 =
-0.8951
-0.8951
0.1951
0.1951

+
+
-

1.2351i
1.2351i
0.3659i
0.3659i

-3

Exercise 6
Coding :
'Ex 6'
P5=conv([1 7 10 9],[1 -3 6 2 1])
3s^3+6s^2+2s+1), assign to
P5,

%Form (s^3+7s^2+10s+9)(s^4%Display

Result :
Ex 6
P5 =
1

-5

23

48

81

28

-5

23

48

81

28

P5 =

Exercise 7
Coding :
'Ex 7'
numf=[7 9 12];
denf=conv(poly([0 -7]),[1 10 100]);
[K,p,k]=residue(numf,denf)

%Display label
%Define numerator of F(s) as
'numf'.
%Define denominator of F(s) as
'denf'.
%Findresidue and assign to K;find
roots of denominator and assign
to p;find constant and assign to
k

Result :
ans =
Ex 7
K =
0.2554 - 0.3382i
0.2554 + 0.3382i
-0.5280
0.0171
p =
-5.0000 + 8.6603i
-5.0000 - 8.6603i
-7.0000
0
k =
[]

Exercise 8
Coding :
'Example 2.3'
numy=32;
deny=poly([0 -4 -8]);
[r,p,k]=residue(numy,deny)

%Display label
%Define numerator as 'numy'
%Define denominator as 'deny' in polynomials.
%Calculate residue and assign to r, find roots
of denominator and assign to p; find constat
and assign to k

Result :
ans =
Example 2.3
r =
1
-2
1
p =
-8
-4
0
k =
[]

Exercise 9
Coding :
'Ex9:Vector method, PolynomiL form'
numf=150*[1 2 7]
denf=[1 5 4 0]
'F(s)'
F=tf(numf,denf)
clear
'Vector Method, Fortored Form'
numg=[-2 -4]
deng=[-7 -8 -9]
K=20
'G(s)'
G=zpk(numg,deng,K)
clear
'Rational Expression Method,Polynomial Form'
s=tf('s')
F=150*(s^2+2*s+7)/[s*(s^2+5*s+4)]
G=20*(s+2)*(s+4)/[(s+7)*(s+8)*(s+9)]
clear
'Rational Expression Method, Factor Form'
s=zpk('s')
F=150*(s^2+2*s+7)/[s*(s^2+5*s+4)]
G=20*(s+2)*(s+4)/[(s+7)*(s+8)*(s+9)]

Result :
ans =
Ex9:Vector method, PolynomiL form
numf =
150

300

denf =
1

ans =
F(s)
Transfer function:
150 s^2 + 300 s + 1050
---------------------s^3 + 5 s^2 + 4 s
ans =
Vector Method, Fortored Form
numg =
-2

-4

deng =
-7

-8

K =
20
ans =
G(s)
Zero/pole/gain:
20 (s+2) (s+4)

-9

1050

## ----------------(s+7) (s+8) (s+9)

ans =
Rational Expression Method,Polynomial Form
Transfer function:
s
Transfer function:
150 s^2 + 300 s + 1050
---------------------s^3 + 5 s^2 + 4 s
Transfer function:
20 s^2 + 120 s + 160
-------------------------s^3 + 24 s^2 + 191 s + 504
ans =
Rational Expression Method, Factor Form
Zero/pole/gain:
s
Zero/pole/gain:
150 (s^2 + 2s + 7)
-----------------s (s+1) (s+4)
Zero/pole/gain:
20 (s+2) (s+4)
----------------(s+7) (s+8) (s+9)

Exercise 10
Coding :
'Ex10:Coefficient of F(s)'
numftf=[10 40 60]
denftf=[1 4 5 7]
'Roots for F9s)'
[numfzp,denfzp]=tf2zp(numftf,denftf)
'Roots for G(s)'
numgzp=[-2 -4]
K=10
dengzp=[0 -3 -5]
'Coefficient fo G(s)'
[numgtf,dengtf]=zp2tf(numgzp',dengzp',K)

Result :
ans =
Ex10:Coefficient of F(s)
numftf =
10

40

60

denftf =
1
ans =
Roots for F9s)
numfzp =
-2.0000 + 1.4142i
-2.0000 - 1.4142i
denfzp =
-3.1163
-0.4418 + 1.4321i
-0.4418 - 1.4321i
ans =

## Roots for G(s)

numgzp =
-2

-4

K =
10
dengzp =
0

-3

-5

ans =
Coefficient fo G(s)
numgtf =
0

10

60

80

15

dengtf =
1

Exercise 11
Coding :
'Ex11'
'Fzpk1(s)'
Fzpk1=zpk([-2 -4],[0 -3 -5],10)
'Ftf1'
Ftf1=tf(Fzpk1)
'Ftf2'
Ftf2=tf([10 40 60],[1 4 5 7])
'Fzpk2'
Fzpk2=zpk(Ftf2)

Result :
ans =
Ex11
ans =
Fzpk1(s)
Zero/pole/gain:
10 (s+2) (s+4)
-------------s (s+3) (s+5)
ans =
Ftf1
Transfer function:
10 s^2 + 60 s + 80
-----------------s^3 + 8 s^2 + 15 s
ans =
Ftf2
Transfer function:
10 s^2 + 40 s + 60
--------------------s^3 + 4 s^2 + 5 s + 7
ans =
Fzpk2
Zero/pole/gain:
10 (s^2 + 4s + 6)
--------------------------------(s+3.116) (s^2 + 0.8837s + 2.246)