Ee3512 c&i Lab Manual
Ee3512 c&i Lab Manual
EE3512
REGULATION - 2021
Prepared By
Mr. J. Madhavan
ASSISTANT PROFESSOR
NAME :
REGISTER NUMBER :
DEPARTMENT :
YEAR / SEMESTER :
INSTITUTE MISSION
➢ To provide conducive learning environment and training so as to empower the students with
dynamic skill development for employability.
➢ To foster Entrepreneurial spirit amongst the students for making a positive impact on
remarkable community development.
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
DEPARTMENT VISION
DEPARTMENT MISSION
PEO1 : Find employment in Core Electrical and Electronics Engineering and service sectors.
PEO2 : Get elevated to technical lead position and lead the organization competitively.
PEO3 : Enter into higher studies leading to post-graduate and research degrees.
PEO4 : Become consultant and provide solutions to the practical problems of core
organization.
PEO5 : Become an entrepreneur and be part of electrical and electronics product and service
industries.
BONAFIDE CERTIFICATE
It is certified that this is a bonafide record of work done by
Mr. / Ms. ____________________________ Reg. No., ______________ of
Vth semester, B.E., - Electrical and Electronics Engineering in the
EE3512 Control and Instrumentation Laboratory during the academic
year 2023 – 2024 (ODD SEM).
LIST OF EXPERIMENTS:
14. State space model for classical transfer function using MATLAB
15. Determination of steady state error using MATLAB
COURSE OUTCOMES:
Upon successful completion of the course, the students will be able to:
CO1: To model and analyze simple physical systems and simulate the performance in analog and
digital platform.
CO2: To design and implement simple controllers in standard forms.
CO3: To design compensators based on time and frequency domain specifications.
CO4: To design a complete closed control loop and evaluate its performance for simple physical
systems.
CO5: To analyze the stability of a physical system in both continuous and discrete domains.
MAPPING OF COs WITH POs AND PSOs:
POs PSOs
COs
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3
CO1 3 3 3 3 3 1.5 2 3 3 3
CO2 3 3 3 3 3 1.5 2 3 3 3
CO3 3 3 3 3 3 1.5 2 3 3 3
CO4 3 3 3 3 3 1.5 2 3 3 3
CO5 3 3 3 3 3 1.5 2 3 3 3
Avg 3 3 3 3 3 1.5 2 3 3 3
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
III YEAR / V SEMESTER
CYCLE – I
1. Step, ramp and impulse response.
2. Identification of damping in second order
3. Time domain analysis
4. Stability analysis using Pole zero maps and Routh Hurwitz Criterion in simulation platform.
5. Root Locus based analysis in simulation platform.
CYCLE – II
Expt. Marks
Date Name of the Experiment Page No. Signature
No. Obtained
CYCLE – I
CYCLE – II
Staff Incharge
2. GENERAL INSTRUCTIONS FOR LABORATORY CLASSES
iii. Theory
7. After completing the experiment, the answer to pre lab viva-voce questions should
be neatly written in the workbook.
4
Exp. No.: 1 Date:
Exercise Number: 1
To obtain step, ramp, impulse response of first and second order system.
Control system
3. tool box 1
b) THEORY:
Transfer function: It is the laplace of the output divided by the laplace of the input of
a system.
Step-The response of a system (with all initial conditions equal to zero at t= 0-, i.e,
zero state response) to the unit step input is called the unit step response.
Ramp : The ramp function is a unary real function whose graph is shaped like a graph.
c) PROCEDURE:
Enter the program in the editor window. If the program is typed in command window,
the functions should be typed without semi-colon.
Enter the values in the numerator & denominator depending on order of the system.
The syntax used to get transfer function is tf.
The syntax used for impulse is impulse.
Finally save the program and run it.
1
DESIGN PROCEDURE/ DESIGN CALCULATIONS:
A=input(‘enter numerator’);
B=input(‘enter denominator’);
h = tf(A,B);
step(h);
impulse(h);
subplot(2,1,1),plot(step(h));
subplot(2,1,2),plot(impulse(h));
Ramp Function
t = -1:0.1:1;
x1= t>0;
u = (t.*x1);
lsim(h,u,t);
STEP RESPONSE:
2
IMPULSE RESPONSE:
RAMP RESPONSE:
3
FIRST ORDER
STEP RESPONSE
IMPULSE RESPONSE:
10
4
RAMP RESPONSE:
11
5
Pre lab questions:
1. What is meant by order of a system?
The highest power of the s term in the denominator of the transfer function of the
system is called the order of the system.
Result:
Thus, the step, ramp, impulse response of first order and second order systems are obtained.
12
6
Exp. No.: 2 Exercise Number: 2 Date:
To study and identify the damping in second order system using MATLAB.
FACILITIES REQUIRED:
MATLAB software
PROCEDURE:
THEORY:
𝜔𝑛 2
The general second order transfer function is G(s) =
𝑠2 +2𝜁𝜔𝑛 𝑠+𝜔𝑛 2
Where,
ζ=Damping coefficient
𝝎𝒏 =natural frequency
As the ζ value is varied, the output graph is varied for the various inputs given be it
step, ramp or impulse.
For ‘Undamped’ system, the graph is of continuous wave w.r.t. critical line. The
amplitude differs for different 𝝎 values. If it is high, amplitude is high and vice versa.
For ‘Under Damped’ system, the graph is also a continuous wave but the amplitude
decreases with time and it finally merges with the critical line passing through 1.
13
7
For ‘Critically Damped’ system, the wave increases gradually and gets in straight line
with the value of 1. This indicates the perfect damping required in a system which is
controllable.
For ‘Over Damped’ system, the wave always remains below or critical line for any𝝎
value.
The graph always remains the same for the damping conditions. Just the nature of
waves changes w.r.t. to the
Critically damped system is the commonly used and effective.
With varying 𝝎 values, the amplitude changes. They don’t make any significant
changes. The important factor is ζ.
We can check the damping by using any values in the place of 𝝎&ζ.
100
Undamped Condition (step) G(s)=
𝒔𝟐 +𝟏𝟎𝟎
14
8
𝟏𝟎𝟎
Undamped Condition (ramp) G(s)=
𝒔𝟐 +𝟏𝟎𝟎
15
9
𝟏𝟎𝟎
Under Damped (step) G(s)=
𝒔𝟐 +𝟐𝒔+𝟏𝟎𝟎
𝟏𝟎𝟎
Under Damped (ramp) G(s)=
𝒔𝟐 +𝟐𝒔+𝟏𝟎𝟎
16
10
𝟏𝟎𝟎
Critically Damped (step) G(s)=
𝒔𝟐 +𝟐𝟎𝒔+𝟏𝟎𝟎
17
11
𝟏𝟎𝟎
Critically Damped (ramp) ) G(s)=
𝒔𝟐 +𝟐𝟎𝒔+𝟏𝟎𝟎
18
12
RESULT:
Thus the importance of Damping Coefficient ζwas studied with its various conditions and for
various 𝝎values for various inputs.
19
13
Exp. No.: 3 Exercise Number: 3 Date:
To Analyze the Time Domain specifications of Under damped second order system.
A) THEORY:
We can analyze the time domain of the second order under damped system. Peak value,
Rise time, overshoot, settling time and steady point.
The system has some in-built tolerance; therefore, the settling time is achieved when the
wave signal enters this tolerance range. But in some ζ conditions, the wave isn’t actually
merging with reference line but is in continuous wave motion but since it has entered the
tolerance range, it is considered as settled.
B) PROCEDURE:
C) PROGRAM /COMMAND :
1. num= [10000];
2. den =[1,20,10000];
3. y= tf(num,den);
4. stepplot(y)
20
14
D) CIRCUIT DIAGRAM / MODEL GRAPH:
1)
2)
3)
21
15
1) Here, ζ=0.1 and 𝜔 = 5
INFERENCE:
Through the above graphs we understand that if the 𝜁 value is varied in between 0 and
1, the no. of waves may increase or decrease depending on 𝜔 value.
If 𝜔 is taken of very high value, then rise time as well as settling time decreases. And
if it is taken low then, the rise time and settling time are of mediocre range.
If the ζ value is very much decreased then high overshooting takes place and it takes
time to settle, i.e., high peak value is attained.
In some cases we may see that settling time is achieved much before the peak value is
attained. It is because that the ζ value is very close to achieve critical damping
condition.
RESULT:
Thus the time domain of second order underdamped system is analyzed for various ζ
and 𝜔 values. The graphs for the same are also plotted with step response.
PRELAB QUESTIONS:
22
16
Exp. No.: 4 Date:
Exercise Number: 4
Title of the Experiment: STABILITY ANALYSIS USING ROUTH- HURWITZ METHOD
Date of the Exercise:
AIM OF THE EXPERIMENT:
FACILITIES REQUIRED:
MATLAB software.
Computer.
THEORY:
The theory of network synthesis states that any pole of the system lies on the right hand side
of the origin of the s plane, it makes the system unstable. On the basis of this condition A.
Hurwitz and E.J.Routh started investigating the necessary and sufficient conditions of
stability of a system. We will discuss two criteria for stability of the system. A first criterion
is given by A. Hurwitz and this criterion is also known as Hurwitz Criterion for
stability or Routh Hurwitz Stability Criterion. With the help of characteristic equation, we will
make a number of Hurwitz determinants in order to find out the stability of the system. We
define characteristic equation of the system as:
PROCEDURE:
23
17
Program:
clear
clc
%% firstly it is required to get first two row of routh matrix
e=input('enter the coefficients of characteristic equation: ');
disp('-------------------------------------------------------------------------')
l=length(e);
m=mod(l,2);
if m==0
a=rand(1,(l/2));
b=rand(1,(l/2));
for i=1:(l/2)
a(i)=e((2*i)-1);
b(i)=e(2*i);
end
else
e1=[e 0];
a=rand(1,((l+1)/2));
b=[rand(1,((l-1)/2)),0];
for i=1:((l+1)/2)
a(i)=e1((2*i)-1);
b(i)=e1(2*i);
end
end
%% now we genrate the remaining rows of routh matrix
l1=length(a);
c=zeros(l,l1);
c(1,:)=a;
c(2,:)=b;
for m=3:l
for n=1:l1-1
c(m,n)=-(1/c(m-1,1))*det([c((m-2),1) c((m-2),(n+1));c((m-1),1) c((m-1),(n+1))]);
end
end
disp('the routh matrix:')
disp(c)
%% now we check the stablity of system
if c(:,1)>0
disp('System is Stable')
else
disp('System is Unstable');
end
24
18
OUTPUT:
enter the coefficients of characteristic equation: [1 1 3 1 6]
-------------------------------------------------------------------------
the routh matrix:
1 3 6
1 1 0
2 6 0
-2 0 0
6 0 0
System is Unstable
Result:
Thus, the stability of a system using Routh Hurwitz method was determined.
25
19
Exercise Number: 5 Date:
Exp. No.: 5
Title of the Experiment: STABILITY ANALYSIS OF LINEAR SYSTEM USING ROOT LOCUS
Date of the Exercise:
• ROOT LOCUS
• THEORY:
The root locus technique is a powerful tool for adjusting the location of closed
loop poles to achieve the desired system performance by varying one or more system
parameters. The path taken by the roots of the characteristics equation when open
loop gain K is varied from 0 to ∞ are called root loci.
• PROCEDURE:
Problem:
The open loop transfer function of a unity feedback system G(s)=K/s (s2 +8s+17)
Draw the root locus using MATLAB Software. (Assume K=1).
26
20
Matlab Program:
num=[1];
den=[1 8 17 0];
figure(1);
rlocus(num,den);
grid;
Matlab Output:
27
21
Pre lab questions:
• How many roots are in the left half of s plane for the equation s3 - 4s2 + s + 6 ?
• Discuss the effects of adding poles and zeros in a closed loop system.
Result:
• The transfer function of an unity feedback system is G(s) = k/s(s+2). Find the
Thus, the stability
centroid of the system
and breakaway point.by using Root locus was determined.
28
22
Exercise Number: 6
Exp. No.: 6 Date:
To analyze the stability of the given linear system using Bode plot .
• BODE PLOT :
THEORY:
The bode plot is a frequency response plot of the transfer function of a system.
A bode plot consists of two graphs. One is plot of the magnitude of a sinusoidal
transfer function versus log ω . The other is plot of the phase angle of a sinusoidal
transfer function versus logω .The main advantage of the bode plot is that
multiplication of magnitude can be converted into addition. Also a simple method for
sketching an approximate log magnitude curve is available.
Problem:
• The open loop transfer function of a unity feedback system G(s)=K/s(s2 +2s+3)
Draw the Bode Plot. Find (i)Gain Margin (ii)Phase Margin (iii)Gain cross over
frequency (iv)Phase cross over frequency (v) Resonant Peak (vi)Resonant
Frequency (vii)Bandwidth and Check the same results using MATLAB
Software. (Assume K=1)
29
23
Matlab Program:
%Draw the Bode Plot for the given transfer functionG(S)=1/S(S2+2S+3) %Find (i)Gain
Margin (ii) Phase Margin (iii) Gain Cross over Frequency %(iv) Phase Cross over Frequency
(v)Resonant Peak (vi)Resonant %Frequency (vii)Bandwidth
num=[1 ];
den=[1 2 3 0];
w=logspace(-1,3,100);
figure(1);
bode(num,den,w);
title('Bode Plot for the given transfer function G(s)=1/s(s^2+2s+3)')
grid;
[Gm Pm Wcg Wcp] =margin(num,den);
Gain_Margin_dB=20*log10(Gm)
Phase_Margin=Pm
Gaincrossover_Frequency=Wcp
Phasecrossover_Frequency=Wcg
[M P w]=bode(num,den);
[Mp i]=max(M);
Resonant_PeakdB=20*log10(Mp)
Wp=w(i);
Resonant_Frequency=Wp
for i=1:1:length(M);
if M(i)<=1/(sqrt(2));
Bandwidth=w(i)
break;
end;
end;
Matlab Output:
30
24
Gain_Margin_dB =15.5630
Phase_Margin = 76.8410
Gaincrossover_Frequency = 0.3374rad/sec
Resonant_PeakdB = 10.4672
Bandwidth = 0.5356
• How can you analyse the stability of the system with Bode plot?
Result:
Thus, the stability of the given linear system using Bode plot was determined.
31
25
Exp. No.: 7 Exercise Number: 7 Date:
• To analyze the stability of the given linear system using polar plot.
• POLAR PLOT :
THEORY:
The Polar plot provides a simple test for stability of a closed- loop control
system by examining the open-loop system. Stability of the closed-loop control system
may be determined directly by computing the poles of the closed-loop transfer function.
The Polar Criteria can tell us things about the frequency characteristics of the system.
A Polar plot is used in automatic control and signal processing for assessing the stability
of a system with feedback. It is represented by a graph in polar coordinates in which the
gain and phase of a frequency response are plotted. The plot of these phasor quantities
shows the phase as the angle and the magnitude as the distance from the origin. This
plot combines the two types of Bode plot — magnitude and phase — on a single graph
with frequencry as a parameter along the curve.
Problem:
• The open loop transfer function of a unity feedback system G(s)=K/s(s2 +2s+3)
Draw the Polar Plot. Find (i)Gain Margin (ii)Phase Margin (iii)Gain cross over
frequency (iv)Phase cross over frequency and Check the same results using
MATLAB Software. (Assume K=1)
32
26
Matlab Program:
num=[1];
den=[1 3 3 1];
figure(1);
polar (num,den)
[Gm,Pm,Wcg,Wcp] = margin(num,den)
grid;
[Gm,Pm,Wcg,Wcp] = margin(num,den);
Gain_Margin = Gm
Phase_Margin = Pm
PhaseCrossover_Frequency = Wcg
GainCrossover_Frequency = Wc
Matlab Output:
Gain_Margin = 8.0011
Phase_Margin = -180
33
27
PhaseCrossover_Frequency = 1.7322 rad/sec
GainCrossover_Frequency = 0 rad/sec
• What is contour?
Result:
Thus, the stability of the given linear system using polar plot was determined.
34
28
Answers
num = 20
den = 1 5 4 0
Transfer function:
20
-----------------
s^3 + 5 s^2 + 4 s
Gm = 1.0000
Pm = 7.3342e-006
Wcp = 2.0000
Wcp = 2.0000
PM = -135
Wg = 0.7016
beta = 5.7480
tau = 11.4025
Transfer function:
11.4 s + 1
-----------
65.54 s + 1
Transfer function:
228 s + 20
---------------------------------------
65.54 s^4 + 328.7 s^3 + 267.2 s^2 + 4 s
Gm1 = 5.2261
Pm1 = 38.9569
Wcg1 = 1.9073
Wcp1 = 0.7053
29
Ex. No: Date:
Exp. No.: 8
Date:
To Design the Lead, Lag and Lead-Lag compensator for the system using MATLAB
Software.
APPARATUS REQUIRED :
1. MATLAB Software.
DESIGN PROCEDURE
1. Design a Phase Lag compensator for the unity feedback transfer function G(s)=K
/s(s+1)(s+4) has specifications : a. Phase Margin>_ 400 b. The steady state error for ramp
input is less than or equal to 0.2 and check the results using MATLAB Software.
Solution
num=[20]
den=[1 5 4 0]
G=tf(num,den)
figure(1);
bode(num,den);
grid;
[Gm,Pm,Wcp,Wcp]=MARGIN(num,den)
30
Gmdb=20*log10(Gm);
W=logspace(-1,1,100)';
[mag,ph]=BODE(G,W);
ph=reshape(ph,100,1);
mag=reshape(mag,100,1);
PM=-180+40+5
Wg=interp1(ph,W,PM)
beta=interp1(ph,mag,PM)
tau=8/Wg
Gc=D*G
figure(2);
bode(Gc);
grid;
[Gm1,Pm1,Wcg1,Wcp1]=MARGIN(Gc)
31
bode plot f or uncompensated system G(s)=20/S(S+1)(S+4)
100
50
Magnitude (dB)
-50
-100
-90
-135
Phase (deg)
-180
-225
-270
-2 -1 0 1 2
10 10 10 10 10
Frequency (rad/sec)
50
Magnitude (dB)
-50
-100
-150
-90
-135
Phase (deg)
-180
-225
-270
-4 -3 -2 -1 0 1 2
10 10 10 10 10 10 10
Frequency (rad/sec)
32
2. Design a Phase Lead compensator for the unity feedback transfer function G(s)=K
/s(s+2) has specifications : a. Phase Margin>_ 550 b. The steady state error for ramp
input is less than or equal to 0.33 and check the results using MATLAB Software. (Assume
K=1)
Solution
num=[5]
den=[1 2 0]
G=tf(num,den)
figure(1);
bode(num,den);
grid;
[Gm,Pm,Wcg,Wcp]=MARGIN(num,den)
GmdB=20*log10(Gm)
PM=55-Pm+3
alpha=(1-sin(PM*pi/180))/(1+sin(PM*pi/180))
Gm=-20*log10(1/sqrt(alpha))
w=logspace(-1,1,100)';
[mag1,phase1]=BODE(num,den,w);
mag=20*log10(mag1);
magdB=reshape(mag,100,1);
Wm=interp1(magdB,w,-20*log10(1/sqrt(alpha)))
33
tau=1/(Wm*sqrt(alpha))
Gc=D*G
figure(2);
bode(Gc);
grid;
[Gm1,Pm1,Wcg1,Wcp1]=MARGIN(Gc)
Answers
num = 5
den = 1 2 0
Transfer function:
5
---------
s^2 + 2 s
Gm = Inf
Pm = 47.3878
Wcg = Inf
Wcp = 1.8399
GmdB = Inf
PM = 10.6122
alpha = 0.6890
Gm = -1.6181
Wm = 2.0853
tau = 0.5777
Transfer function:
0.5777 s + 1
------------
0.398 s + 1
34
Transfer function:
2.889 s + 5
---------------------------
0.398 s^3 + 1.796 s^2 + 2 s
Gm1 = Inf
Pm1 = 54.4212
Wcg1 = Inf
Wcp1 = 2.0849
20
Magnitude (dB)
-20
-40
-60
-80
-90
Phase (deg)
-135
-180
-1 0 1 2
10 10 10 10
Frequency (rad/sec)
20
Magnitude (dB)
-20
-40
-60
-80
-90
Phase (deg)
-135
-180
-1 0 1 2
10 10 10 10
Frequency (rad/sec)
35
3. Design a Phase Lead-lag compensator for the unity feedback transfer function G(s)=K
/s(s+1)(s+2) has specifications : a. Phase Margin>_ 500 b. The Velocity error constant
Kv=10 sec-1 and check the results using MATLAB Software. (Assume K=1).
Solution
num=[20]
den=[1 3 2 0]
G=tf(num,den)
figure(1);
bode(num,den);
Title('bode Plot for Uncompensated System G(s)=20/S(S+1)(S+2)')
grid;
[Gm,Pm,Wcg,Wcp]=MARGIN(num,den)
GmdB=20*log10(Gm);
W=logspace(-1,1,100)';
ph=reshape(ph,100,1);
mag=reshape(mag,100,1);
PM=-180+50+5
Wg=interp1(ph,W,PM)
beta=interp1(ph,mag,PM)
tau=8/Wg
alpha=20/beta
mag=20*log10(mag)
Gm=-20*log10(1/sqrt(alpha))
36
Wm=interp1(mag,W,-20*log10(1/sqrt(alpha)))
tau=1/(Wm*sqrt(alpha))
figure(2);
bode(Gc1);
[Gm1,Pm1,Wcg1,Wcp1]=MARGIN(Gc1)
Answers
num = 20
den = 1 3 2 0
Transfer function:
20
-----------------
s^3 + 3 s^2 + 2 s
Gm = 0.3000
Pm = -28.0814
Wcg = 1.4142
Wcp = 2.4253
PM = -125
Wg = 0.4247
beta = 21.2032
tau = 18.8362
Transfer function:
18.84 s + 1
-----------
399.4 s + 1
alpha = 0.9433
Gm = -0.2537
Wm = 2.4546
tau = 0.4195
Transfer function:
0.4195 s + 1
------------
0.3957 s + 1
Transfer function:
37
158 s^2 + 385.1 s + 20
------------------------------------------------
158 s^5 + 873.9 s^4 + 1516 s^3 + 802.6 s^2 + 2 s
Gm1 = 6.1202
Pm1 = 48.5839
Wcg1 = 1.3976
Wcp1 = 0.4279
50
Magnitude (dB)
-50
-100
-90
-135
Phase (deg)
-180
-225
-270
-2 -1 0 1 2
10 10 10 10 10
Frequency (rad/sec)
100
Magnitude (dB)
50
-50
-100
-150
-90
-135
Phase (deg)
-180
-225
-270
-4 -3 -2 -1 0 1 2
10 10 10 10 10 10 10
Frequency (rad/sec)
RESULT
Thus, the Lead, Lag and Lead-Lag compensator for the system was designed.
38
Exp. No.: 9 Exercise Number:8 Date:
Title of the Experiment: Design of PID Controller for first order and second order systems
Date of the Exercise:
To design a PID controller for the following first order and second order system,
3.6
1. 𝐺 (𝑠) =
(𝑠+10)
5
2. 𝐺 (𝑠) = 2
𝑠 +6𝑠+5
e) THEORY:
Most PID controllers are adjusted on-site and many different types of tuning rules
have been proposed in different literatures. Using these tuning rules, delicate and fine tuning
of PID controllers can be made on-site. Also, automatic tuning methods have been developed
and some of the PID controllers may possess on-line automatic tuning capabilities. Modified
forms of PID control, such as I-PD control and two-degrees-of- freedom PID control, are
currently in use in industry
f) PROCEDURE:
35
39
e) BLOCK DIAGRAM:
Kp =
Ki =
36
40
Kd =
g) MODEL OUTPUT RESPONSE:
37
41
Figure 2: First order controlled closed loop response
38
42
Pre lab questions:
2. What is conventional controller?
Result:
Thus, the PID controller of first order and second order system was designed.
39
43
Exp. No.: 10 Date:
AIM:
To discretization of continuous system and effect of sampling of first and second
order system.
APPARATUS REQUIED:
MATLAB Software
THEORY:
Every time a continuous system is discretized, there will be some level of discretization
error. This happens because the discretized model is an approximation of the continuous
model.
There are several techniques (methods) for transfer function discretization, the most
common being:
44
Continuous system – step input time response
This step input response is going to be used as a comparison baseline with the discretized
systems.
Using the discretization methods above, we are going to convert the transfer function of
the first order system H(s) from continuous time domain (s) to discrete time domain (z).
45
As you can see, the discretized version (forward Euler) of the first order system is made
up entirely of algebraic operations. This allows the equation to be encoded into
programming languages (like C, C++) and run on microcontrollers.
The [k] values represent the values at the current calculation step and the [k-1] values
represent the values at the previous calculation step. For example u[k-1] is the value of
the input signal at the previous calculation step and y[k-1] is the value of the output at
previous calculation step.
To verify if the discretized function gives the same output for a step response as the
continuous version (equation (1)), we are going to implement equation (8) in Xcos as a
block diagram.
46
Discrete system (forward Euler) for first order system – Xcos block diagram
Running the model with a sample time of 0.01 s will result in the same output as for the
continuous system.
Discrete system (forward Euler) for first order system – step input response
47
48
Discrete system (backward Euler) for first order system – Xcos block diagram
Running the model with a sample time of 0.01 s will result in the same output as for the
continuous system.
Discrete system (forward Euler) for first order system – step input response
49
50
Discrete system (trapezoidal) – step input time response
Running the model with a sample time of 0.01 s will result in the same output as for the
continuous system.
Discrete system (trapezoidal / Tustin) for first order system – step input response
RESULT:
Thus, the discretization of continuous system and effect of sampling of first and
second order system was obtained.
51
Exp. No.: 11 Date:
AIM:
To test controllability and observability properties of the system by both Kalman’s
Test and Gilbert’s Test mathematically.
APPARATUS REQUIED:
MATLAB Software
Learning Outcomes:
After the successful completion of this experiment, students will be able to
1. Test controllability and observability properties of the system
2. Verify controllability and observability by software programming
PROGRAM:
clear
close all
clc
%% Initial values
r=3; % number at the unit place in roll number
d=1; % number at tenth place in date of birth
m=1; % number at unit place in month of birth
%% Controllability Test
% Kalman's Test: Method 1 (by calculation)
Qc1=[B A*B A^2*B];
52
R1=rank(Qc1);
% Gilbert's Test
[M,D]=eig(A); % To get diagonal and modal matrices
lambda=inv(M)*A*M;
B_tilde=inv(M)*B;
%% Observability Test
% Kalman's Test: Method 1 (by calculation)
Qo1=[C; C*A; C*A^2];
R3=rank(Qo1);
% Gilbert's Test
C_tilde=C*M;
RESULT:
53
CONTROL SYSTEMS AND SIMULATION LAB
Apparatus:
S.No. Apparatus Range Quantity
1 Personal Computer with MATLAB software --- 01
Problem Specifications:
2) Input is num=[ ]
den=[ ]
Procedure:
1) Obtain the state space model of the given system represented in the form of transfer function.
2) Verify the result with MATLAB.
Sample Program:
%Conversion of Transfer Function to State Space%
num=[ ]
den=[ ]
sys=tf(num,den)
[A B C D]=tf2ss(num,den)
Theoretical calculations:
Result:
Thus, the the state space model for the given transfer function was obtained.
Apparatus:
S.No. Apparatus Range Quantity
1 Personal Computer with MATLAB software --- 01
Procedure :
Program :
clear();
numg=[1 0]
deng=[1 2]
G=tf(numg,deng)
kp=dcgain(G);
ess=5\1+kp
numsg=conv([1 0],numg)
densg=deng
sg=tf(numsg,densg)
kv=dcgain(sg)
ess=5\kv
nums2g=conv([1 0],numsg)
dens2g=densg
s2g=tf(nums2g,dens2g)
kp=dcgain(s2g)
ess=3\ka
Theoretical calculations:
Result:
Thus, the steady state error for the given input was obtained.