Lab 07 PDF
Lab 07 PDF
Section: …………………………………………………………
Remarks: …………………………………………………
Objective: The objective of this exercise will be to study the performance characteristics of
first and second order systems using MATLAB.
List of Equipment/Software
Following equipment/software is required:
MATLAB
Personal Computer
Figure 1: RC Circuit
If the capacitor is initially uncharged at zero voltage when the circuit is switched on, it
starts to charge due to the current ‘i' through the resistor until the voltage across it reaches the
supply voltage. As soon as this happens, the current stops flowing or decays to zero, and the
circuit becomes like an open circuit. However, if the supply voltage is removed, and the circuit is
closed, the capacitor will discharge the energy it stored again through the resistor. The time it
takes the capacitor to charge depends on the time constant of the system, which is defined as the
time taken by the voltage across the capacitor to rise to approximately 63% of the supply
voltage. For a given RC-circuit, this time constant is 𝜏 = 𝑅𝐶. Hence its magnitude depends on
the values of the circuit components.
The RC circuit will always behave in this way, no matter what the values of the
components. That is, the voltage across the capacitor will never increase indefinitely. In this
respect we will say that the system is passive and because of this property it is stable.
For the RC-circuit as shown in Fig. 1, the equation governing its behavior is given by using
KVL:
𝑣𝑅 (𝑡) + 𝑣𝑐 (𝑡) = 𝐸(𝑡)
𝑖(𝑡)𝑅 + 𝑣𝑐 (𝑡) = 𝐸(𝑡)
𝑑𝑣𝑐 (𝑡)
(𝐶 ) (𝑅) + 𝑣𝑐 (𝑡) = 𝐸(𝑡)
𝑑𝑡
Control Technology Lab (ET 373 L) Page 2
Lab Experiment 07: Performance of First order and Second order using Matlab
where τ is time constant of the system and the system is known as the first order system. The
performance measures of a first order system are its time constant and its steady state.
Exercise 1:
a) Given the values of R and C, obtain the unit step response of the first order system.
i. R=2KΩ and C=0.01F
ii. R=2.5KΩ and C=0.003F
b) Verify in each case that the calculated time constant (𝜏 = 𝑅𝐶) and the one measured from
the figure as 63% of the final value are same.
c) Obtain the steady state value of the system.
The differential equation for the above Mass-Spring system can be derived as follows
𝑑 2 𝑥(𝑡) 𝑑𝑥(𝑡)
𝑀 2
+𝐵 + 𝐾𝑥(𝑡) = 𝐹𝑎 (𝑡)
𝑑𝑡 𝑑𝑡
Applying the Laplace transformation we get
(𝑀𝑠 2 + 𝐵𝑠 + 𝐾) ∗ 𝑋(𝑠) = 𝐹(𝑠)
provided that, all the initial conditions are zeros. Then the transfer function representation of the
system is given by
𝑂𝑢𝑡𝑝𝑢𝑡 𝐹(𝑠) 1
𝑇𝐹 = = = 2
𝐼𝑛𝑝𝑢𝑡 𝑋(𝑠) (𝑀𝑠 + 𝐵𝑠 + 𝐾)
The generalized notation for a second order system described above can be written as
𝜔𝑛2
𝑌(𝑠) = 𝑅(𝑠)
𝑠 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2
Rise Time: The time for a system to respond to a step input and attains a response equal to a
percentage of the magnitude of the input. The 0-100% rise time, Tr, measures the time to 100%
Control Technology Lab (ET 373 L) Page 4
Lab Experiment 07: Performance of First order and Second order using Matlab
of the magnitude of the input. Alternatively, Tr1, measures the time from 10% to 90% of the
response to the step input.
Peak Time: The time for a system to respond to a step input and rise to peak response.
Overshoot: The amount by which the system output response proceeds beyond the desired
response. It is calculated as
𝑀𝑃 − 𝑓𝑣
𝑃. 𝑂. = 𝑡 × 100%
𝑓𝑣
where 𝑀𝑃𝑡is the peak value of the time response, and fv is the final value of the response.
Settling Time: The time required for the system’s output to settle within a certain percentage of
the input amplitude (which is usually taken as 2%). Then, settling time, Ts, is calculated as
4
𝑇𝑠 =
𝜁𝜔𝑛
Example 1: The generalized equation for 2nd order system can be written as
𝑌(𝑠) 𝜔𝑛2
= 2
𝑅(𝑠) 𝑠 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2
Write a Matlab Code to find the 𝑡𝑟, 𝑡𝑝, 𝑀𝑝&𝑡𝑠 of a second order system, when
𝜔𝑛 = 7 and 𝜁 = 0.4.
Solution:
>> num = [0 0 49];
>> den = [1 5.6 49];
>> t = 0: 0.005: 5;
>> [y, x, t] = step (num, den, t);
>> %Rise Time
>> r = 1; while y(r) < 1.0001; r = r + 1; end
>> rise_time = (r – 1) * 0.005;
>> % rise_time = 05550
>> %Peak Time
>> [ ymax, tp ] = max(y);
>> peak_time = (tp – 1) * 0.005;
>> %peak_time = 0.7850
>> % Maximum Overshoot
>> max_overshoot = ymax – 1;
>> % max_overshoot = 0.0948
>> % Settling Time
>> s = 1001; while y(s) > 0.98 & y(s) < 1.02; s = s -1; end
>> settling_time = (s – 1) * 0.005;
>> % settling_time = 1.1856
Exercise 2: Effect of damping ratio ζ on performance measures. For a single-loop second order
feedback system given below
a) Find the step response of the system for values of ωn = 1 and ζ = 0.1, 0.4, 0.7, 1.0 and
2.0. Plot all the results in the same figure window and fill the following table.
ζ Rise time Peak Time % Overshoot Settling time Steady state value
0.1
0.4
0.7
1.0
2.0
b) Write a Matlab Code to find the 𝑡𝑟, 𝑡𝑝, 𝑀𝑝&𝑡𝑠 of a second order system, when 𝜔𝑛 = 5
and 𝜁 = 0.7.