MATLAB Basics For SISO LTI Systems
MATLAB Basics For SISO LTI Systems
SYSTEM REPRESENTATION
MATLAB defines systems in 3 ways
1) Transfer functions can be formed in the following ways
NOTE: Polynomials in MATLAB are represented as a vector.
a) >> num = [1 5];
>> den = [1 4 5];
>> sys = tf(num,den)
Transfer function:
s+5
-------------
s^2 + 4 s + 5
Transfer function:
s+5
-------------
s^2 + 4 s + 5
ݔଵ
= ݕሾ1 0ሿ ቂ ݔቃ + ሾ0ሿݑ
ଶ
To create this system in MATLAB:
a=
x1 x2
x1 -1 2
x2 0 -3
b=
u1
x1 0
x2 3
c=
x1 x2
y1 1 0
d=
u1
y1 0
Continuous-time model.
3) Zero-Pole-Gain
Zero/pole/gain:
4 (s+3) (s+5)
-----------------
(s+1) (s+2) (s+3)
Zero/pole/gain:
4 (s+3) (s+5)
-----------------
(s+1) (s+2) (s+3)
POLE-ZERO CANCELLATION
To cancel any common poles and zeros in a transfer function, you can use the ݉݅݊ ݈ܽ݁ݎcommand.
Example:
>> sys = tf([1 3],[1 3 0])
Transfer function:
s+3
---------
s^2 + 3 s
>> minreal(sys)
Transfer function:
1
-
s
DATA EXTRACTION
For quick access to the numerator and denominator of the transfer function of an LTI system
• [num,den] = tfdata(sys) returns the numerator and denominator of the transfer function sys.
NOTE: For a single SISO model,
• [num,den] = tfdata(sys,'v')
This command returns the numerator and denominator as row vectors rather than cell arrays.
For access to A,B,C,D matrices of an LTI system, the following syntax may be used:
• [A,B,C,D] = ssdata(sys)
To extract information of the zeros, poles and gain of an LTI system the following syntax can be used:
• [Z,P,K] = zpkdata(sys)
Again, [Z,P,K] = ZPKDATA(SYS,'v') returns the zeros Z and poles P as column vectors rather than cell
arrays.
CONVERSION
A system in one of the three representations can be converted to any other using the following syntax:
[input_arguments] = conversion_command [ouput_arguments]
From To Command Input Output
State Space Transfer function ss2tf [A,B,C,D] [num,den]
State Space Zero-Pole-Gain ss2zp [A,B,C,D] [z,p,k]
Transfer function State Space tf2ss [num,den] [A,B,C,D]
Transfer function Zero-Pole-Gain tf2zp [num,den] [z,p,k]
Zero-Pole-Gain Transfer function zp2tf [z,p,k] [num,den]
Zero-Pole-Gain State Space zp2ss [z,p,k] [A,B,C,D]
SYSTEM CONNECTIONS
• Series
G
G1 G2
>> G = series(G1,G2)
Transfer function:
s+3
-------------------------
5 s^3 + 18 s^2 + 19 s + 6
Parallel
G1
G
+
+
G2
>> G = G1+G2
Transfer function:
6 s^2 + 21 s + 11
-------------------------
5 s^3 + 18 s^2 + 19 s + 6
>> G = parallel(G1,G2)
Transfer function:
6 s^2 + 21 s + 11
-------------------------
5 s^3 + 18 s^2 + 19 s + 6
Feedback
+
G1
-
G2
>> feedback(G1,G2)
Transfer function:
5 s^2 + 18 s + 9
-------------------------
5 s^3 + 18 s^2 + 20 s + 9
>> G1/(1+G2*G1)
Transfer function:
5 s^4 + 33 s^3 + 73 s^2 + 63 s + 18
---------------------------------------------
5 s^5 + 33 s^4 + 84 s^3 + 105 s^2 + 67 s + 18
>> minreal(ans)
Transfer function:
s^2 + 3.6 s + 1.8
-------------------------
s^3 + 3.6 s^2 + 4 s + 1.8
Note that the feedback function cancels the common poles and zeros whereas you have to use the
minreal command if you use direct arithmetic operations on the transfer functions.