AUTOMATIC CONTROL
RADOUAN AIT MOUHA
ID:12190210101
CONTROL SCIENCE AND ENGINEERING
ANHUI POLYTECHNIC UNIVERSITY
2020/04/11
1
CONTENT:
Harmonic Analysis
Stability
Root-Locus
State space
Controllability and observability
The Nyquist plot
2
HARMONIC ANALYSIS
DEFINITION :WIKIPEDIA
Harmonic analysis is a branch of mathematics concerned with the
representation of functions or signals as the superposition of basic waves, and
the study of and generalization of the notions of Fourier series and Fourier
transforms (i.e. an extended form of Fourier analysis). In the past two
centuries, it has become a vast subject with applications in areas as diverse
as number theory, representation theory, signal processing, quantum
mechanics, tidal analysis and neuroscience.
The term "harmonics" originated as the Ancient Greek word harmonikos,
meaning "skilled in music".[1] In physical eigenvalue problems, it began to
mean waves whose frequencies are integer multiples of one another, as are
the frequencies of the harmonics of music notes, but the term has been
generalized beyond its original meaning.
The classical Fourier transform on Rn is still an area of ongoing research,
particularly concerning Fourier transformation on more general objects such
as tempered distributions. For instance, if we impose some requirements on a
distribution f, we can attempt to translate these requirements in terms of the
Fourier transform of f. The Paley–Wiener theorem is an example of this. The
Paley–Wiener theorem immediately implies that if f is a
nonzero distribution of compact support (these include functions of compact
support), then its Fourier transform is never compactly supported. This is a
very elementary form of an uncertainty principle in a harmonic-analysis
setting.
3
Stability
Code MATLAB 1 :
>> %stability checking
clear all;
close all;
n=3:30;
num=[ 1];
den=[ 1 2 -3 4];
r=roots(den);
if (abs(den)<1)
disp('STABLE SYSTEM4');
else
disp('UNSTABLE SYSTEM');
end;
UNSTABLE SYSTEM
Code MATLAB 2:
>> clear all;
close all;
num=[ 1 -0.45 2];
den=[1 -1.1 -0.1 0.2 ];
zplane(num,den)
>>
Code3
clear all;
close all;
num=[9];
den=[1 2 9];
zplane(num,den)
4
1
0.8
0.6
0.4
Imaginary Part
0.2
3
0
-0.2
-0.4
-0.6
-0.8
-1
-1 -0.5 0 0.5 1
Real Part
System is stable
1
Imaginary Part
2
0
-1
-2
-3
-3 -2 -1 0 1 2 3
Real Part
System is unstable
5
Design based on the Root-Locus
Code poles and roots , function
>> GH
GH =
1
---------------------------
z^4 + 8 z^3 + 36 z^2 + 80 z
Sample time: unspecified
Discrete-time transfer function.
>> num=[1];
>> den=[1 8 36 80 0];
>> GH=tf(num,den)
GH =
1
---------------------------
s^4 + 8 s^3 + 36 s^2 + 80 s
Continuous-time transfer function.
>> [r p k]=residuez(num,den)
r=
0.1000 + 0.5500i
0.1000 - 0.5500i
0.8000 + 0.0000i
0.0000 + 0.0000i
p=
-2.0000 + 4.0000i
-2.0000 - 4.0000i
-4.0000 + 0.0000i
0.0000 + 0.0000i
k=
[]
6
Code zero pole gain model :
>> GH=zpk([], [0,-4,-2,-2+4i,-2-4i],1)
GH =
1
-----------------------------
s (s+4) (s+2) (s^2 + 4s + 20)
Continuous-time zero/pole/gain model.
Code roots :
p=pole(GH)
p=
0.0000 + 0.0000i
-4.0000 + 0.0000i
-2.0000 + 0.0000i
-2.0000 + 4.0000i
-2.0000 - 4.0000i
>> z=zero(GH)
z=
0×1 empty double column vector
>> p=roots(den)
p=
0.0000 + 0.0000i
-2.0000 + 4.0000i
-2.0000 - 4.0000i
-4.0000 + 0.0000i
We can visually see where the poles and zeros are by plotting them in the z-plane
with the funtion below:
GH =
1
-----------------------------
s (s+4) (s+2) (s^2 + 4s + 20)
Continuous-time zero/pole/gain model.
>> pzmap(GH)
7
Pole-Zero Map
4
3
Imaginary Axis (seconds -1)
2
-1
-2
-3
-4
-4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0
Real Axis (seconds -1)
Now let’s plot the pzmap for the closed loop system as we seep the gain k from 0 to
10
Code matlab :
for k= 1:10
pzmap(feedback(GH*k,1));
hold on
end
Pole-Zero Map
5
3
Imaginary Axis (seconds -1)
-1
-2
-3
-4
-5
-4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0
Real Axis (seconds-1)
8
Still does not fill the entire plot:
for k= 1:10:500
pzmap(feedback(GH*k,1));
hold on
end
Pole-Zero Map
5
Imaginary Axis (seconds -1)
-5
-6 -5 -4 -3 -2 -1 0 1
-1
Real Axis (seconds )
It looks good but it is kind hard to figure out the range of k with this function , so
fotunately we have another function as below:
>> hold off
>> rlocus(GH)
Root Locus
20
15
Imaginary Axis (seconds -1)
10
-5
-10
-15
-20
-20 -15 -10 -5 0 5 10 15
Real Axis (seconds -1)
9
The informations might use for discover the stability of system
Root Locus
20 System: GH
Gain: 13
15
Pole: -1.8
Imaginary Axis (seconds-1)
10 Damping: 1
Overshoot (%): 0
5
Frequency (rad/s): 1.8
0
-5
-10
-15
-20
-20 -15 -10 -5 0 5 10 15
Real Axis (seconds -1 )
Sisotool in matlab open control system desinger :
10
Code matlab :
>> GH1= 1/(z*(z+4)*(z^2 +4*z+20));
GH2= 1/(z*(z+4)*(z^2 +4*z+20));
GH3= 1/(z*(z+4)*(z^2 +4*z+20));
GH4= 1/(z*(z+4)*(z^2 +4*z+20));
GHstacked = stack(1, GH1, GH2 ,GH3, GH4)
GHstacked(:,:,1,1) =
1
---------------------------
z^4 + 8 z^3 + 36 z^2 + 80 z
GHstacked(:,:,2,1) =
1
---------------------------
z^4 + 8 z^3 + 36 z^2 + 80 z
GHstacked(:,:,3,1) =
1
---------------------------
z^4 + 8 z^3 + 36 z^2 + 80 z
GHstacked(:,:,4,1) =
1
---------------------------
z^4 + 8 z^3 + 36 z^2 + 80 z
11
STATE SPACE : EQUATION
Code MATLAB :
>> %state space equation
A=[0 1; -5 -6];
B=[0;2];
C=[1 0; 0 1];
D=[0;0];
%we cn creat state space model with the following function
sys = ss(A ,B ,C ,D)
sys =
A=
x1 x2
x1 0 1
x2 -5 -6
B=
u1
x1 0
x2 2
C=
x1 x2
y1 1 0
y2 0 1
D=
u1
y1 0
y2 0
Continuous-time state-space model.
%Convert to transfer function
G=tf(sys)
G=
From input to output...
2
1: -------------
s^2 + 6 s + 5
2s
2: -------------
s^2 + 6 s + 5
Continuous-time transfer function .
12
STATE SPACE : POLE PLACEMENT
Code MATLAB :
>> %Define stat matrices
A=[0 1;2 -1];
B=[1 ;0];
C=[1 0];
D=0;
% creat state space model
sys=ss(A ,B ,C ,D);
%check open loop eigenvalue
E = eig(A)
E=
1
-2
%Desired closed loop eigenvalues
P=[-2 -1];
%solve for k using pole placement
k = place(A,B,P)
k=
2 1
%check for closed loop eigenvalues
Acl =A-B*k
Ecl =eig(Acl)
Acl =
-2 0
2 -1
Ecl =
-1
-2
%creat sstem closed loop
13
syscl=ss(Acl,B ,C ,D)
syscl =
A=
x1 x2
x1 -2 0
x2 2 -1
B=
u1
x1 1
x2 0
C=
x1 x2
y1 1 0
D=
u1
y1 0
Continuous-time state-space model.
>> %check step response
step(sys)
10 25
Step Response
8
5
Amplitude
0
0 10 20 30 40 50 60
Time (seconds)
>> %check step response
step(sys);
14
step(syscl)
Step Response
0.5
0.45
0.4
0.35
0.3
Amplitude
0.25
0.2
0.15
0.1
0.05
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (seconds)
>> %solve for kr
kdc= dcgain(syscl)
kr=1/kdc
kdc =
0.5000
kr =
2
>> %creat scaled input closed loop system
syscl_scaled =ss(Acl ,B*kr ,C,D)
step(syscl_scaled)
syscl_scaled =
A=
x1 x2
x1 -2 0
x2 2 -1
B=
u1
x1 2
x2 0
C=
x1 x2
15
y1 1 0
D=
u1
y1 0
Continuous-time state-space model.
Step Response
1
0.9
0.8
0.7
0.6
Amplitude
0.5
0.4
0.3
0.2
0.1
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (seconds)
Pole placement is fancy Root-Locus with gain matrix
Full state feedback is a misnomer
CONTROLLABILITY AND OBSERVABILITY
Code MATLAB :
>> close all;
>> clear all;
>> %define the matrices
>> A=[0 1;2 -1];
>> % A is the state matrix
>> B=[1 ;0];
>> %B is the input vector
>> C=[1 0];
>> %C is the output vector
16
>> D= zeros(size(C,1),size(B,2));
>> % D is the feedforward
>> eig(A);
>> % it is not stable
>> % verify the controlability and observability
>> Cm = ctrb(A,B)
%Controlability matrix
Om = obsv(A,C)
%Observability matrix
if rank(Cm) == size(A,1)
'THE SYSTEM IS CONTROLLABLE'
else
'THE SYSTEM IS NOT CONTROLLABLE '
end
if rank(Om) == size(A,1)
'THE SYSTEM IS OBSERVABLE'
else
'THE SYSTEM IS NOT OBSERVABLE'
end
Cm =
1 0
0 2
Om =
1 0
0 1
ans =
THE SYSTEM IS CONTROLLABLE
ans =
THE SYSTEM IS OBSERVABLE
>> %drawing Nequit plot in Matlab
num=[1];
den=[1 3 2 0];
G = tf(num,den);
nyquist(G);
axis equal
>>
17
Nyquist Diagram
0.8
0.6
0.4
Imaginary Axis
0.2
-0.2
-0.4
-0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Real Axis
>> t = linspace(0 ,2*pi,10000);
>> x= cos(t);
>> y= sin(t);
>> hold on
>> plot(x-1,y)
Nyquist Diagram
2.5
2
System: G
1.5 Real: -0.616
Imag: 0.915
Imaginary Axis
Frequency (rad/s): -0.411
1
0.5
-0.5
-1
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
Real Axis
>> %gm= gain margin , pm= phase margin
>> [gm ,pm ,wpc, wgc]= margin(G)
18
gm =
6.0000
pm =
53.4109
wpc =
1.4142
wgc =
0.4457
Nyquist Diagram
2.5
2
System: G
1.5 Real: -0.616
Imag: 0.915
Imaginary Axis
Frequency (rad/s): -0.411
1
0.5
-0.5
-1
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
Real Axis
Nyquist Diagram
0.5 System: G
Real: -0.167
Imaginary Axis
Imag: 2.04e-17
Frequency (rad/s): -1.41
0
-0.5
-1
-1.5 -1 -0.5 0 0.5 1 1.5
Real Axis
19