Experiment 5 State Variable Models
Experiment 5 State Variable Models
Name __________________________________
Regd. No. ___________________________
Description
TF2SS Transfer function to state-space conversion.
[A,B,C,D] = TF2SS(NUM,DEN) calculates the state-space representation:
SS2TF State-space to transfer function conversion.
[NUM,DEN] = SS2TF(A,B,C,D,iu) calculates the transfer function:
LSIM(SYS,U,T) plots the time response of the LTI model SYS to the input
signal described by U and T. The time vector T consists of regularly spaced
time samples and U is a matrix with as many columns as inputs and whose i-th
row specifies the input value at time T(i).
Procedure
Section-1
C(s)/R(s) = 24/s3+9s2+26s+24
Experiment 5
Page 1 of 6
Name __________________________________
Regd. No. ___________________________
Write Matlab commands to convert the above transfer function into state space.
>> N= [24];
>> D= [1 9 26 24];
>> [A B C D] =tf2ss(N, D)
A=
B=
C=
D=
Experiment 5
Page 2 of 6
Name __________________________________
Regd. No. ___________________________
Section-2
u(t)
+
vc
_
+
vo
_
An RLC circuit.
r = 3; l = 1; c = 0.5;
A = [0 1/c; 1/l r/l];
B = [1/c; 0];
C = [0 r];
D = [0];
x0 = [1 1];
% initial conditions.
t = [0:0.01:5]; % time range is 0 to 5 sec with an increment of 0.01 sec.
u = 0*t ;
% zero input.
[y, x] = lsim(A, B, C, D, u, t, x0);
lsim function returns two parameters, output matrix y having one column and state
variable matrix x having two columns. Use size(y) and size(x) to see the number of
rows and columns in y and x.
Note: Number of rows in x and a y matrix is equal to the number of data points in
time vector t.
Use following commands to observe the time response of the system defined in
previous step.
subplot(3, 1, 1);
% divide the figure window into 3 rows and 1 column.
plot(t, x(:,1));
% plot the 1st state variable, column 1 of matrix x.
xlabel('time'); ylabel('x1');
subplot(3, 1, 2);
plot(t, x(:,2));
% plot the 2nd state variable, column 1 of matrix x.
Experiment 5
Page 3 of 6
Name __________________________________
Regd. No. ___________________________
xlabel('time'); ylabel('x2');
subplot(3, 1, 3);
plot(t, y));
% plot the output state variable.
xlabel('time'); ylabel('output (y)');
Sketch the state variables x1, x2 and the output y. Label all the curves appropriately.
Experiment 5
Page 4 of 6
Name __________________________________
Regd. No. ___________________________
Change the system parameters R, L and C in the circuit shown above to generate four
types of time responses as shown in the following table. Also, show the values of R, L
and C and position of poles for each type of response.
Case
1
2
3
4
Type of Response
Overdamped
Critically Damped
Underdamped
Oscillatory
System Parameters
R=
L=
C=
R=
L=
C=
R=
L=
C=
R=
L=
C=
Position of Poles
Case-2: Underdamped.
Experiment 5
Page 5 of 6
Name __________________________________
Regd. No. ___________________________
Case-4: Oscillatory.
Checked by:
Experiment 5
Date:
Page 6 of 6