Difference Equation From State Space Canonical Form of Discrete System

Verified

Added on  2022/08/20

|9
|1043
|264
AI Summary
A = 0 -2 -1 1 0 0 0 1 0 0 0 1 0 B = 1 0 0 0 C = 0 0 0 5 D = 0 seconds Question 3: Robust sliding mode controller design with = -5 From which Question 2 From Real-translation, time advance property of the Z transform, From the difference equation provided Taking Z transform on both sides and obtaining the transfer equation, we assume 0 initial conditions since no condition was provided Using MATLAB, the system’s state space

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Question 1
The linear system is given as
X ( t ) = AX ( t ) +Bu( t)
But
u ( t )=u(kT )
Hence
X ( t ) = AX ( t ) +Bu ( kT ) for kT t< ( k +1 ) T
If
A=
[1 0
0 1 ], B= [1
0 ]
From state space canonical form of a discrete system, the system is expressed in the
form of
[ x (k +1)T
x1 (k +1)T ]= [a1 a2
1 0 ] [ x (kT )
x1 (kT ) ]+[b
0 ]u (kT )
Where
x1 ( k ) T =x (k 1) T
Substituting the variables in the question, we have
[ x (k +1)T
x1 (k +1)T ]= [a1 a2
1 0 ] [ x (kT )
x1 (kT ) ]+[b
0 ]u (kT )
[ x1 (k +1) T
x (k +1)T ]= [ 1 0
0 1 ] [ x1 (kT )
x (kT ) ] + [ b
0 ] u(kT )
x1 ( k+ 1 ) T =x1 (kT )+bu(kT )
x ( k +1 ) T =x (kT )
Which gives the difference equation shown below
x ( k +1 ) T x (k 1)T =u (kT )
Comparing with the desired difference equation
X [ ( k +1 ) T ]=Φ ( T ) X ( kT )+φ (T ) u(kT )
From which
Φ ( T )= [0
1 ]
φ ( T ) = [ 1
0 ]

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Question 2
From Real-translation, time advance property of the Z transform,
Z { x ( k +n ) T }=Zn
[ X ( z )
k=0
n 1
x (kT )Z k
]
From the difference equation provided
c ( k +4 ) +2 c ( k +2 ) c ( k +1 ) +c ( k )=5 u(k )
Taking Z transform on both sides and obtaining the transfer equation, we assume 0
initial conditions since no condition was provided
Z4 C ( Z ) +2 Z2 C ( Z ) ZC ( Z ) +C ( Z ) =5 U (Z)
C ( z )
U ( z) = 5
Z 4 +2 Z2+Z +1
Using MATLAB, the system’s state space is obtained from the MATLAB script
below
z=tf('z')
NUM = [0 0 0 0 5 ]; % NUM and DEN should be same length
DEN = [1 0 2 1 1];
[A,B,C,D] = tf2ss(NUM,DEN)
z =
z
Sample time: unspecified
Discrete-time transfer function.
A =
0 -2 -1 -1
1 0 0 0
0 1 0 0
Document Page
0 0 1 0
B = 1
0
0
0
C = 0 0 0 5
D = 0
Document Page
Question 3:
Robust sliding mode controller design with λ = -5
[ x '1
x ' 2 ]= [ 0 1
1 2 ] [ x1
x2 ]+[0
1 ]u (t)+ [ 0
w1 ]
From the above state equations are,
˙x1=x2
˙x2= x1 +2 x2 +u ( t ) +w1
Let the sliding variable be defined as σ .
σ =c x1 + x2 c >0
The derivative of the sliding variable with respect to time is
˙σ =c ˙x1 + ˙x2=0
˙σ = ( c +2 ) x2 x1 +u ( t ) =0
Solving for u ( t )
ueq ( t ) =x1 ( c +2 ) x2
So, the controller equation is
u ( t ) =ueq ( t ) ksign( σ) k > 0
The initial values of c and k are chosen to be 1 and 1. By deviating p and k from their
values, the robustness is checked. This is known as parameter perturbations. A
MATLAB script is developed to simulate the system dynamics.
The script code is as shown below:
clc; clear; close all;
x1(1) = 1;
x2(1) = 1;
c = 1;
k = 1;
Ts = 0.01;
t=0: Ts:20;
w1 = 0.1*sin(cos(t));
for n=1: length(t)
sigma(n) = c*x1(n) + x2(n);
u(n) = x1(n) - (c + 2) *x2(n) - k*sign(sigma(n));
x1(n + 1) = x1(n) + Ts*x2(n);
x2(n + 1) = x2(n) + Ts*(-x1(n) + 2*x2(n) + u(n) +
w1(n));

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
end
figure
plot(t,x1(1:end-1));
xlabel('Time (sec)');
ylabel('x1');
title('x1 State Response');
grid
figure
plot(t,x2(1:end-1));
xlabel('Time (sec)');
ylabel('x2');
title('x2 State Response');
grid
figure
plot(t,u)
xlabel('Time (sec)');
ylabel('Input');
title('The Input');
grid
figure
plot(x1,x2);
xlabel('x1 state');
ylabel('x2 state');
title('Phase portrait');
grid
The results from the script is four plots as shown:
Figure 1: State x1 response
Document Page
Figure 2: : State x2 response
Figure 3: The input equation
Figure 4: Initial Conditions are [1, 1] as guided to the stable point (0,0)
Document Page
Question 4:
The robotic arm is made of a dc motor. Since most motors are second order system,
the resulting model should as well be a second order. From system identification tool,
two poles (for a second order system) are and either one or none zeros in the transfer
function estimation. In state space estimation, two poles are used. In both cases, a
sampling time of 0.01 seconds is used. This is just an arbitrary value whose choice
cannot be justified.
The input and output data were plotted on the same graph to help visualize the trend.
A sampling time of 0.01 seconds was used.
Figure 5: General Visualization of the data given
From System identification, a number of models were tried and we settled on one
with four poles and three zeros. For this model, both continuous and discrete version
were evaluated.

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Figure 6: The two models from system identification interface
The discrete model resulted in the following output:
Status: Estimated using TFEST
Fit to estimation data: 87.378%, FPE: 0.0235142
Transfer function:
-1.414 z^-1 + 1.967 z^-2 - 1.381 z^-3
--------------------------------------------------------------------
1 + 0.01837 z^-1 + 0.5601 z^-2 + 0.1484 z^-3 + 0.1066 z^-4
Model output:
Figure 7: Discrete time model output
Document Page
The continuous model resulted in the following output:
Status: Estimated using TFEST
Fit to estimation data: 87.024%, FPE: 0.0239266
Termination condition: Maximum number of iterations reached..
Number of iterations: 100, Number of function evaluations: 832
Transfer function:
16.63 s^3 - 547.9 s^2 + 1.158e05 s - 2.401e06
----------------------------------------------------------
s^4 + 36.66 s^3 + 6032 s^2 + 1.506e04 s + 2.281e06
Model output:
Figure 8: : Continuous time model output
The two model outputs are close to the data visualized in Figure 5.
1 out of 9
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]