Examples: Using Matlab For Solutions: Transfer It To The Partial Fraction Form)
Examples: Using Matlab For Solutions: Transfer It To The Partial Fraction Form)
num = [ 2 5 3 6 ]
den = [ 1 6 11 6 ]
Answers :
r = - 6.0 - 4.0 3.0
p = -3.0 -2,0 -1.0
K = 2.0
num = [2 5 3 6]
p=
num =
2
den = [1 6 11 6];
[r,p,k] = residue(num,den)
r=
-6.0000
-4.0000
3.0000
-3.0000
-2.0000
-1.0000
k=
2
Use : r = [ - 6 - 4 3 ];
And, p = [ -3 -2 -1 ];
K= 2
Use the Matlab Commands:
[ num, den ] = residue ( r ,p ,k);
printsys (num , den ,s)
r = [-6 -4 3]
r=
-6 -4
p = [-3 -2 -1]
p=
-3 -2 -1
k = [2];
[num,den] = residue(r,p,k);
printsys (num,den,'s');
num/den =
2 s^3 + 5 s^2 + 3 s + 6
----------------------s^3 + 6 s^2 + 11 s + 6
Examples
1- Expand the following into partial fraction using Matlab:
C(s) / R(s) = ( s^2 + 2 s + 3) / ( s + 1 )^3
num = [ 0 1 2 3]
den = [ 1 3 3 1 ]
num = [ 0 1 2 3 ];
den = [ 1 3 3 1 ];
[ r , p , k ] = residue ( num , den )
r=
1.0000
0.0000
2.0000
p=
-1.0000
-1.0000
-1.0000
k=
[]
num = [ 0 0 4 16 12 ] ;
den = [ 1 12 44 48 0] ;
[ z , p . K ] = tf2zp ( num , den )
num = [ 0 0 4 16 12 ];
den = [ 1 12 44 48 0 ];
[ z , p , k ] = tf2zp (num ,den)
z=
-3
-1
p=
0
-5.5803 + 1.4302i
-5.5803 - 1.4302i
-0.4197 + 1.1271i
-0.4197 - 1.1271i
k=
Z = [ -1 ; -3 ]
P = [ 0 ; -2 ; -4 ; -6 ];
K=4
[ num , den ] = zp2tf (z , p , k )
Printsys ( num , den , s )
z=
-1
-3
p = [ 0 ; -2 ; -4 ; -6 ];
k=4
k=
4
[ num , den ] = zp2tf ( z , p , k );
printsys (num , den , 's' )
num / den =
4 s^2 + 16 s + 12
---------------------------s^4 + 12 s^3 + 44 s^2 + 48 s
num = [ 0 0 25 ];
den = [ 1 4 25 ];
% ***** Enter the following step response command
step ( num , den )
% ***** Enter grid and title of the plot *************
Grid
Title ( Unit Step Response of G (s) = 25 / ( s^2 + 4s +25) )
num = [ 0 0 25];
den = [ 1 6 25 ];
step( num , den)
num = [0 0 25];
den = [1 6 25];
t = 0:0.005:5;
[y, x, t] = step (num, den, t);
r =1; while y (r) < 1.0001; r = r + 1; end;
risen _ time = (r - 1) * 0.005
rise _ time =
0.5550
[ymax, tp ] = max (y);
peak _ time = (tp - 1) * 0.005
peak _ time =
0.7850
s = 1001; while y (s) > 0.98 & y (s) < 1.02; s = s - 1; end;
settling _ time = (s - 1) * 0.005
settling _ time =
1.1850
Num = [ 0 0 1];
den = [1 0.2 1];
Impulse (num , den )
Grid
Title (Unit-Impulse Response of
G (s) = 1 / ( s^2 + 0.2 s + 1))
num = [ 0 0 1 ];
den = [ 1 0.2 1 ];
impulse (num , den);
grid
title ( Unit - Impulse Response of G (s) = 1
/ ( s^2 + 0.2 s + 1 ) )
t = 0 : 0.2 : 10;
zeta = [ 0 0.2 0.4 0.6 0.8 1.0 ];
for n = 1 : 6;
num = [ 0 0 1 ];
den = [ 1 2*zeta(n) 1 ];
[y(1:51,n),x,t] = step(num,den,t);
end
Plot (t,y)
grid
text (3.5,0.86,'1.0')
% To plot a three -dimensional diagram, enter the command mesh (t, zeta, y').
Mesh (t, zeta, y')
num = [ 0 0 1 ];
den = [ 1 0.2 1 ];
impulse ( num, den );
grid
title (' Unit-Step Response of G (s) = 1 / ( s^2 + 0.2 s +1 )')
Ramp Response
Num = [ 0 0 0 1 ]
Den = [ 1 1 1 0 ]
num = [ 0 0 0 1 ];
den = [ 1 1 1 0 ];
t = 0 : 0.1 : 7;
c = step (num, den, t);