Practical No.
Aim: Calculate the state transition matrix and eigen values for given state space
representation of the system.
Q.1 Calculate the state transition matrix and eigen values of matrix A for the following systems.
Hence calculate the system output y(s).
Ans:
a)
MATLAB Code:
clc;clear;
syms s;
syms U; % laplace transform of system input
A = [0 1 ; -1 -5]; % system matrix
B = 0; % input matrix
C = [1 2]; % output matrix
D = 0; % feedforward matrix
x0 = [1 ; 0]; % initial conditions
I = eye(2);
T = inv(s*I - A); % inverse of (sI - A) matrix
Phi = ilaplace(T); % state transition matrix
Eg = eig(A); % eigenvalues of A
X = T*(x0 + B*U); % X = (sI - A)^-1 * ( x0 + BU )
Y = C*X + D*U; % Output Y = CX + DU , output of system
y = ilaplace(Y); % Inverse laplace of Y
Output:
Eg = % eigen values of A
-0.2087
-4.7913
Phi = % state transition matrix
[exp(-(5*t)/2)*(cosh((21^(1/2)*t)/2) + (5*21^(1/2)*sinh((21^(1/2)*t)/2))/21),
(2*21^(1/2)*exp(-(5*t)/2)*sinh((21^(1/2)*t)/2))/21]
[ -(2*21^(1/2)*exp(-(5*t)/2)*sinh((21^(1/2)*t)/2))/21, exp(-
(5*t)/2)*(cosh((21^(1/2)*t)/2) - (5*21^(1/2)*sinh((21^(1/2)*t)/2))/21)]
Y= % output Y(s)
(s + 5)/(s^2 + 5*s + 1) - 2/(s^2 + 5*s + 1)
b)
MATLAB Code:
clc;clear;
syms s;
syms U; % laplace transform of system input
A = [-2 1 0 ; 0 0 1 ;0 -6 -1]; % system matrix
B = [1 ; 0 ; 0]; % input matrix
C = [1 0 0]; % output matrix
D = [0]; % feedforward matrix
x0 = [0 ; 0 ; 0]; % initial conditions
I = eye(3);
T = inv(s*I - A); % inverse of (sI - A) matrix
Phi = ilaplace(T); % state transition matrix
Eg = eig(A); % eigenvalues of A
X = T*(x0 + B*U); % X = (sI - A)^-1 * ( x0 + BU )
Y = C*X + D*U; % Output Y = CX + DU , output of system
y = ilaplace(Y); % Inverse laplace of Y
Output:
Phi =
[exp(-2*t), (exp(-t/2)*(cos((23^(1/2)*t)/2) + (13*23^(1/2)*sin((23^(1/2)*t)/2))/23))/8 - exp(-
2*t)/8, exp(-2*t)/8 - (exp(-t/2)*(cos((23^(1/2)*t)/2) -
(3*23^(1/2)*sin((23^(1/2)*t)/2))/23))/8]
[ 0, exp(-t/2)*(cos((23^(1/2)*t)/2) + (23^(1/2)*sin((23^(1/2)*t)/2))/23),
(2*23^(1/2)*exp(-t/2)*sin((23^(1/2)*t)/2))/23]
[ 0, -(12*23^(1/2)*exp(-t/2)*sin((23^(1/2)*t)/2))/23, exp(-
t/2)*(cos((23^(1/2)*t)/2) - (23^(1/2)*sin((23^(1/2)*t)/2))/23)]
Eg =
-2.0000 + 0.0000i
-0.5000 + 2.3979i
-0.5000 - 2.3979i
X=
U/(s + 2)
0
0
Y=
U/(s + 2)
c)
MATLAB Code:
clc;clear;
syms s;
syms U; % laplace transform of system input
A = [-3 1 0 ; 0 -6 1 ;0 0 -5]; % system matrix
B = [0 ; 1 ; 1]; % input matrix
C = [0 1 1]; % output matrix
D = [0]; % feedforward matrix
x0 = [0 ; 0 ; 0]; % initial conditions
I = eye(3);
T = inv(s*I - A); % inverse of (sI - A) matrix
Phi = ilaplace(T); % state transition matrix
Eg = eig(A); % eigenvalues of A
X = T*(x0 + B*U); % X = (sI - A)^-1 * ( x0 + BU )
Y = C*X + D*U; % Output Y = CX + DU , output of system
y = ilaplace(Y); % Inverse laplace of Y
Output:
Phi = % state transition matrix
[exp(-3*t), exp(-3*t)/3 - exp(-6*t)/3, exp(-3*t)/6 - exp(-5*t)/2 + exp(-6*t)/3]
[ 0, exp(-6*t), exp(-5*t) - exp(-6*t)]
[ 0, 0, exp(-5*t)]
Eg = % eigenvalues of A
-3
-6
-5
Y= % output
U/(s + 5) + U/(s + 6) + U/((s + 5)*(s + 6))