0% found this document useful (0 votes)
9 views

8

The document outlines an experiment focused on second-order systems in MATLAB, emphasizing the effects of gain, damping ratio, and natural frequency on transient response and steady-state error. It details the mathematical representation of second-order systems, including key parameters like damping ratio and natural frequency, and provides MATLAB code examples for simulating step and ramp responses. Performance specifications for varying damping ratios and natural frequencies are also presented, illustrating their impact on system behavior.

Uploaded by

ali alaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

8

The document outlines an experiment focused on second-order systems in MATLAB, emphasizing the effects of gain, damping ratio, and natural frequency on transient response and steady-state error. It details the mathematical representation of second-order systems, including key parameters like damping ratio and natural frequency, and provides MATLAB code examples for simulating step and ramp responses. Performance specifications for varying damping ratios and natural frequencies are also presented, illustrating their impact on system behavior.

Uploaded by

ali alaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

69

MATLAB Experiment No. (2)


Second Order Systems

 Objectives:
The objectives of this experiment are to:
1. See the effect of the gain, damping ratio and natural frequency upon
the transient response and steady state error.
2. Evaluate the effect of adding the poles and zeros to the system on the
transient response.
 Second Order system:
The dynamic behavior of the second-order system can be described in
terms of two parameters just as the time constant in the first order
system response. The two parameters are called damping ratio and
natural frequency.
Damping Ratio (𝜻): The parameter that describes the damped oscillations
of the second order response.
Natural Frequency (𝝎𝒏 ): The frequency of the oscillation of the system
without damping.
The block diagram of the general second order system shown in Figure 6.1.

Figure 6.1: Second order closed loop control system.


The standard form of the second order closed loop system can be written:
𝑌(𝑠) 𝜔𝑛2
=
𝑅(𝑠) 𝑠 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2

Khaled Mustafa Mahmoud Session: Spring 2017/2018


70

The poles of the closed loop system are:


𝑠1,2 = − 𝜁𝜔𝑛 ± 𝑗𝜔𝑛 √1 − 𝜁 2 = −𝜎𝑑 ± 𝑗𝜔𝑑
The nature of the response obtained was related to value of 𝜁. Variations
of damping ratio alone yields the complete range of overdamped,
critically damped, undamped, and underdamped responses as shown in
Figure 6.2.

Figure 6.2: Second order response as a function of damping ratio.

 Underdamped Second Order Systems:


The underdamped second order system as shown in Figure 6.3, a
common model for physical problems, displays unique behavior that
must be detailed. It is necessary for both analysis and design.

Khaled Mustafa Mahmoud Session: Spring 2017/2018


71

Figure 6.3: Second order underdamped response specifications.

Settling Time (𝑻𝒔 ): is the time required for the response curve to reach
and stay within (usually 2% or 5%) of the final value. The settling time is
related to the largest time constant of the control system. It is defined by:
4 4
𝑇𝑠 = 4𝜏 = =
𝜁𝜔𝑛 𝜎𝑑
Peak Time (𝑻𝑷 ): The peak time is the time required for the response to
reach the first peak of the overshoot. It is defined by:
𝜋 𝜋
𝑇𝑃 = =
𝜔𝑛 √(1 − 𝜁 2 ) 𝜔𝑑
Maximum Overshoot 𝑴𝑷 (𝑶𝑺%): is the maximum peak value of the
response curve measured from unity. If the final steady-state value of the
response differs from unity, then it is common to use the maximum
percent overshoot. It is defined by:
2
𝑀𝑃 (𝑂𝑆%) = 𝑒 (−𝜋𝜁/(√1−𝜁 ) × 100%
Also, we have:
Max Value − Final Value
𝑂𝑆% = × 100%
Final Value

Khaled Mustafa Mahmoud Session: Spring 2017/2018


72

Hence, the damping ratio "ζ" can be obtained as:


− ln(𝑂𝑆% /100)
ζ=
√(𝜋2 +(ln(𝑂𝑆%/100))2
The amount of the maximum (percent) overshoot directly indicates the
relative stability of the system.
Example 6.1: Consider the typical second order system with transfer
function:
𝑌(𝑠) 𝜔𝑛2
𝑇(𝑠) = =
𝑅(𝑠) 𝑠 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2
1. Write a MATLAB program to obtain the step response curves of the
system on the same figure for 𝜻 = 𝟎. 𝟓, 𝟏, and 𝟏. 𝟐 given 𝜔𝑛 = 2 rad/sec.
2. Repeat part (1) for the unit ramp input.
3. Record the system specifications for each value of 𝜻 in parts (1) and (2).
Solution:
4
𝑇(𝑠) = 2
𝑠 + 4𝜁𝑠 + 4
% 1. To obtain step response of the system for ζ=0.5, 1, and 1.2 on the same figure %
Zeta=[0.5 1 1.2];
hold on
for i=1:3
num=4;
den=[1 4*Zeta(i) 4];
roots(den)
step(num,den)
end
gtext('\zeta=0.5 (Underdamped)')
gtext('\zeta=1 (Critically damped)')
gtext('\zeta=1.2 (Overdamped)')

Khaled Mustafa Mahmoud Session: Spring 2017/2018


73

Step Response
1.4
=0.5 (Underdamped)

1.2
=1 (Critically damped)

0.8
Amplitude

=1.2 (Overdamped)
0.6

0.4

0.2

0
0 1 2 3 4 5 6 7
Time (sec)
Figure 6.4: Unit step response curves for 𝜁 = 0.5, 1, and 1.2.

% 2. To obtain the response curves of the system for ζ=0.5, 1, and 1.2 for unit ramp
input on the same figure %
zeta=[0.5 1 1.2];
hold on
for i=1:3
num=4;
den=[1 4*zeta(i) 4];
t=0:0.1:10;
r=t;
lsim(num,den,r,t)
end
gtext('\zeta=0.5')
gtext('\zeta=1')
gtext('\zeta=1.2')
gtext('Input’)

Khaled Mustafa Mahmoud Session: Spring 2017/2018


74

Linear Simulation Results


10

=0.5
9

6
=1
Amplitude

Input
5

4
=1.2
3

0
0 1 2 3 4 5 6 7 8 9 10
Time (sec)
Figure 6.5: Unit ramp response curves for 𝜁 = 0.5, 1, and 1.2.

Performance specifications for each value of damping ratio as shown in the


following table:
Performance
𝜁 = 0.5 𝜁=1 𝜁 = 1.2
Specifications
Closed Loop Poles −1 ± 𝑗 1.73 −2, −2 −3.72, −1.07

Rise Time (TR ) 0.82 sec 1.68 sec 2.19 sec

Overshoot(OS%) 16.3 % --- ---

Peak Time ( Tp ) 1.84 sec --- ---

Settling Time ( Ts ) 4.04 sec 2.92 sec 3.96 sec

Error [unit step] 0 0 0

Error [unit ramp] 0.5 1 1.2

What is the effect of the damping ratio on the time response of the system?

Khaled Mustafa Mahmoud Session: Spring 2017/2018


75

Example 6.2: Consider the closed-loop system defined by:


𝑌(𝑠) 𝜔𝑛2
=
𝑅(𝑠) 𝑠 2 + 𝜔𝑛 𝑠 + 𝜔𝑛2
The damping ratio equal to 0.5. Plot unit-step response curves 𝑦(t) when
the undamped natural frequency assumes the following values:
𝝎𝒏 = 𝟏, 𝟓, and 𝟏𝟎 rad/sec.
1. Write a MATLAB program to obtain the step responses of the system
on the same figure.
2. Repeat part (1) for the unit ramp input.
3. Record the system specifications for each value of 𝝎𝒏 in part (1).
Solution:

% 1. To obtain step response of the system for 𝝎𝒏 = 𝟏, 𝟓, 𝐚𝐧𝐝 𝟏𝟎 𝐫𝐚𝐝/𝐬𝐞𝐜 on the same
figure %
omegan=[1 5 10];
hold on
for i=1:3
num=omegan(i)^2;
den=[1 omegan(i) omegan(i)^2];
roots(den)
step(num,den)
end
gtext('\omega_n=1')
gtext('\omega_n=5')
gtext('\omega_n=10')

Khaled Mustafa Mahmoud Session: Spring 2017/2018


76

Step Response
1.4

n=5 n=1
1.2

n=10 1

0.8
Amplitude

0.6

0.4

0.2

0
0 2 4 6 8 10 12
Time (sec)

Figure 6.6: Unit step response curves for 𝜔𝑛 = 1, 5, and 10 rad/sec.

% 2. To obtain the response curves of the system for 𝝎𝒏 = 𝟏, 𝟓, 𝐚𝐧𝐝 𝟏𝟎 𝐫𝐚𝐝/𝐬𝐞𝐜 for
unit ramp input on the same figure %
omegan=[1 5 10];
hold on
for i=1:3
num= omegan(i)^2;
den=[1 omegan(i) omegan(i)^2];
t=0:0.1:5;
r=t;
lsim(num,den,r,t)
end
gtext('\omega_n=1')
gtext('\omega_n=5')
gtext('\omega_n=10')
gtext('Input')

Khaled Mustafa Mahmoud Session: Spring 2017/2018


77

Linear Simulation Results


5

4.5
n=10
4

3.5

3
Amplitude

2.5 Input
n=5
n=1
2

1.5

0.5

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (sec)

Figure 6.7: Unit ramp response curves for 𝜔𝑛 = 1, 5, and 10 rad/sec.

Performance specifications for each value of natural frequency as shown


in the following table:
Performance
𝜔𝑛 = 1 rad/sec 𝜔𝑛 = 5 rad/sec 𝜔𝑛 = 10 rad/sec
Specifications
Closed Loop Poles −0.5 ± 𝑗0.86 −2.5 ± 𝑗4.33 −5 ± 𝑗8.66

Rise Time (TR ) 1.64 sec 0.328 sec 0.164 sec

Overshoot(OS%) 16.3 % 16.3 % 16.3 %

Peak Time ( Tp ) 3.67 sec 0.734 sec 0.367 sec

Settling Time ( Ts ) 8.08 sec 1.62 sec 0.808 sec

Error [unit step] 0 0 0

Error [unit ramp] 1 0.2 0.1

Discuss the effect of the natural frequency on the system performance.

Khaled Mustafa Mahmoud Session: Spring 2017/2018


78

Example 6.3: The engine body and tires of a racing vehicle affect the
acceleration and speed attainable. The speed control of the car is
represented by the model shown in Figure 6.8.

Figure 6.8: Racing car speed control.


1. Develop MATLAB m-file to obtain the unit step response of the speed
control system for 𝑲 = 𝟏𝟎, 𝟐𝟎, 𝟓𝟎, and 𝟏𝟎𝟎.
2. Record the system specifications for each value of K in part (1).
Solution:
% 1. To obtain step response of the system for 𝑲 = 𝟏𝟎, 𝟐𝟎, 𝟓𝟎, 𝐚𝐧𝐝 𝟏𝟎𝟎 %
s=tf('s');
K=[10 20 50 100];
hold on
for i=1:4
x=K(i)/((s+2)*(s+5));
sys=feedback(x,1);
pole(sys)
step(sys)
end
gtext('K=10')
gtext('K=20')
gtext('K=50')
gtext('K=100')
title('Step Response of Speed Control System')
xlabel('Time')
ylabel('Speed of the Car')

Khaled Mustafa Mahmoud Session: Spring 2017/2018


79

Step Response of Speed Control System


1.4
K=100

1.2

K=50
1
Speed of the Car

0.8

0.6
K=20

0.4
K=10

0.2

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (sec)

Figure 6.9: Unit step response curves for 𝐾 = 10, 20, 50, and 100.

Performance specifications for each value of gain as shown in the following


table:
Performance
𝐾 = 10 𝐾 = 20 𝐾 = 50 𝐾 = 100
Specifications
Closed Loop Poles −3.5 ± 𝑗2.78 −3.5 ± 𝑗4.21 −3.5 ± 𝑗6.91 −3.5 ± 𝑗9.8

Rise Time (TR ) 0.538 sec 0.357 sec 0.2 sec 0.13 sec

Overshoot(OS%) 1.93 % 7.35 % 20.4 % 32.9 %

Peak Time ( TP ) 1.12 sec 0.749 sec 0.45 sec 0.315 sec

Settling Time ( Ts ) 0.81 sec 1.1 sec 1.08 sec 1.08 sec

Error (𝑒𝑠𝑠 ) 0.5 0.33 0.167 0.091

Discuss the effect of increasing the system gain on the transient and steady
state responses.

Khaled Mustafa Mahmoud Session: Spring 2017/2018


80

Example 6.4: Consider the unity feedback system has the forward transfer
function is given by:
25
𝐺(𝑠) =
𝑠 2 + 4𝑠 + 25

1. Obtain the closed loop step response of the system.


2. Add a pole at −𝟐, −𝟓, and − 𝟐𝟎 to the system and repeat part (1).
3. Add a zero at −𝟐, −𝟓, and − 𝟏𝟎 to the system and repeat part (1).
4. Record the system specifications for each case from the results are
obtained in parts (2), and (3).
Solution:
% 1. and 2. To obtain step response of the system with and without adding poles at
– 2, -5, and -20 %
s=tf('s');
G=25/(s^2+4*s+25);
T=feedback(G,1);
step(T)
pole(T)
P=[2 5 20]
hold on
for i=1:3
GP=25*P(i)/((s+P(i))*(s^2+4*s+25))
TP=feedback(GP,1);
step(TP)
pole(TP)
end
gtext('Pole at -2')
gtext('Pole at -5')
gtext('Pole at -10')

Khaled Mustafa Mahmoud Session: Spring 2017/2018


81

Step Response
0.8
Pole at -5
0.7
Pole at -2
0.6

0.5
Amplitude

0.4

0.3 Pole at -20

0.2

0.1

0
0 1 2 3 4 5 6 7
Time (seconds)

Figure 6.10: Closed loop step response curves with and without adding the poles.

Performance specifications comparison for the system with and without


adding the poles at −𝟐, −𝟓, 𝐚𝐧𝐝 − 𝟐𝟎 as shown in the following table:
Performance
No Pole 𝑃 = −2 𝑃 = −5 𝑃 = −20
Specifications
Dominant Poles −2 ± 𝑗6.78 −1 ± 𝑗4.89 −0.77 ± 𝑗5.73 −1.63 ± 𝑗6.71

3rd Closed Loop Pole --- −4 −7.46 −21.27

Rise Time (TR ) 0.185 sec 0.357 sec 0.248 sec 0.189 sec

Overshoot(OS%) 39.5 % 27.3 % 50.2 % 50.1 %

Peak Time ( TP ) 0.472 sec 0.852 sec 0.667 sec 0.515 sec

Settling Time ( Ts ) 1.95 sec 3.52 sec 4.63 sec 2.89 sec

Error (𝑒𝑠𝑠 ) 0.5 0.5 0.5 0.5

What happen when adding the different values of pole on the system
performance?

Khaled Mustafa Mahmoud Session: Spring 2017/2018


82

% 1. and 3. To obtain step response of the system with and without adding zeros at
– 2, -5, and -10 %
s=tf('s');
G=25/(s^2+4*s+25);
T=feedback(G,1);
step(T)
pole(T)
Z=[2 5 10]
hold on
for i=1:3
GZ=25/Z(i)*(s+Z(i))/(s^2+4*s+25)
TZ=feedback(GZ,1);
step(TZ)
pole(TZ)
end
gtext('No Zero')
gtext('Zero at -2')
gtext('Zero at -5')
gtext('Zero at -10')
grid on

Khaled Mustafa Mahmoud Session: Spring 2017/2018


83

Step Response
0.8
Zero at -2

0.7 No Zero

0.6 Zero at -5

0.5
Amplitude

0.4
Zero at -10

0.3

0.2

0.1

0
0 0.5 1 1.5 2 2.5 3
Time (seconds)

Figure 6.11: Closed loop step response curves with and without adding the zeros.

Performance specifications comparison for the system with and without


adding the zeros at −𝟐, −𝟓, 𝐚𝐧𝐝 − 𝟏𝟎 as shown in the following table:
Performance
No Zero 𝑍 = −2 𝑍 = −5 𝑍 = −10
Specifications
Closed Loop Poles −2 ± 𝑗6.78 −12.5, 4 −4.5 ± 𝑗5.45 −3.25 ± 𝑗6.27

Rise Time (TR ) 0.185 sec 0.0474 sec 0.111 sec 0.16 sec

Overshoot(OS%) 39.5 %

Peak Time ( TP ) 0.472 sec 0.192 sec 0.307 sec 0.383 sec

Settling Time ( Ts ) 1.95 sec 1.07 sec 0.923 sec 1.09 sec

Error (𝑒𝑠𝑠 ) 0.5 0.5 0.5 0.5

What happen when adding the different values of zero on the system
performance?

Khaled Mustafa Mahmoud Session: Spring 2017/2018


84

Example 6.5: For the unity feedback system shown in Figure 6.12:
1. Find the values of 𝑲 and 𝜶 to yield a settling time of 0.2 second and
a 30% overshoot.
2. Use MATLAB to obtain the unit step response of the system and verify
the results in part (1).

Figure 6.12: Feedback control system of Example 6.5.

Solution:
From Figure 6.12:

𝐾
𝐺(𝑠) = , and 𝐻(𝑠) = 1.
𝑠(𝑠 + 𝛼)
𝑌(𝑠) 𝐺(𝑠) 𝐾 𝜔𝑛2
= = = 2
𝑅(𝑠) 1 + 𝐺(𝑠)𝐻(𝑠) 𝑠 2 + 𝛼𝑠 + 𝐾 𝑠 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2

∴ 2𝜁𝜔𝑛 = 𝛼, and 𝜔𝑛2 = 𝐾 .

To find the values 𝜻 𝐚𝐧𝐝 𝝎𝒏:

From the given specifications ( 𝑂𝑆% = 30 and 𝑇𝑠 = 0.2 sec).


− ln(𝑂𝑆% /100) − ln(0.3)
ζ= = = 0.358.
√𝜋2 +[ln(𝑂𝑆%/100)]2 √𝜋2 +[ln(0.3) ]2

4 4
𝑇𝑠 = → 𝜔𝑛 = = 55.86 rad/sec.
𝜁𝜔𝑛 0.358 × 0.2
To find the values of 𝑲 𝐚𝐧𝐝 𝜶:

𝐾 = 𝜔𝑛2 = 55.862 = 3120.

Khaled Mustafa Mahmoud Session: Spring 2017/2018


85

𝛼 = 2𝜁𝜔𝑛 = 2 × 0.358 × 55.86 = 40.


The overall transfer function of Example 8.5:
𝑌(𝑠) 3120
= 2
𝑅(𝑠) 𝑠 + 40 𝑠 + 3120

>> % To obtain the step response for the overall T.F of Example 8.5 %

>> a=3120;

>> b=[1 40 3120];

>> x=tf(a,b);

>> step(x)

System: x
Peak amplitude: 1.3
Overshoot (%): 30 Step Response
1.4
At time (sec): 0.0603

1.2
System: x
Settling Time (sec): 0.195
1

0.8
Amplitude

0.6

0.4

0.2

0
0 0.05 0.1 0.15 0.2 0.25 0.3
Time (sec)

Figure 6.13: Unit step response for Example 6.5.

Khaled Mustafa Mahmoud Session: Spring 2017/2018


86

Assignment 6.1: Consider the closed loop system defined by:


𝑌(𝑠) 𝜔𝑛2
=
𝑅(𝑠) 𝑠 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2
1. Using a “for loop” write a MATLAB program to obtain unit step response
of this system for the following four cases:
Case 1: 𝜁 = 0.3 , 𝜔𝑛 = 1 rad/sec

Case 2: 𝜁 = 0.5 , 𝜔𝑛 = 2 rad/sec

Case 3: 𝜁 = 0.7 , 𝜔𝑛 = 4 rad/sec

Case 4: 𝜁 = 0.8 , 𝜔𝑛 = 6 rad/sec


2. Record and discuss the results are determined in part (1).
--------------------------------------------------------------------------------------------
Assignment 6.2: A robot is programmed to have a tool or welding torch
follow a prescribed path. Consider a robot tool that is to follow a saw tooth
path as shown in Figure 6.14 (a). The transfer function of the plant is:
75(𝑠 + 1)
𝐺(𝑠) =
𝑠(𝑠 + 5)(𝑠 + 20)
For the closed loop system shown in Figure 6.14 (b). Use MATLAB to
calculate the steady state error.

Figure 6.14: Robot path control.

Khaled Mustafa Mahmoud Session: Spring 2017/2018


87

Assignment 6.3: A mechanical vibratory system as shown in Figure 6.15(a).


When 2 lb of force (step input) is applied to the system, the mass oscillates,
as shown in Figure 6.15 (b). The displacement x is measured from the
equilibrium position.

Figure 6.15: (a) Mechanical vibratory system; (b) step-response.

1. Determine 𝒎, 𝒃, and 𝒌 of the system from this response curve.


2. Use MATLAB to obtain the closed loop step response of the system and
verify the results in part (1).
----------------------------------------------------------------------------------------------
Assignment 6.4: Consider the RLC network given in Figure 6.16. Find the step
response when 𝑅 = 2𝐾Ω, 10𝐾Ω, 20𝐾Ω.
1. Obtain the poles corresponding to 𝑅 = 2𝐾Ω, 10𝐾Ω, 20𝐾Ω.
2. What is the effect of increasing value of 𝑅 on damping ratio and natural
frequency of oscillation?

Figure 6.16: A second order system.

Khaled Mustafa Mahmoud Session: Spring 2017/2018


88

Assignment 6.5: You wish to control the elevation of the satellite-tracking


antenna shown in Figure 6.17 (a) and 6.17 (b). The antenna and drive parts
have a moment of inertia 𝐽 and a damping 𝐵, these arise to some extent from
bearing and aerodynamic friction, but mostly from the back emf of the DC
drive motor. The equations of motion are:
𝐽𝜃̈ + 𝐵𝜃̇ = 𝑇𝑐
where 𝑇𝑐 is the torque from the drive motor.
Assume that: 𝐽 = 600000 Kg m2 , 𝐵 = 20000 N. m. sec.

Figure 6.17: (a)Satellite Antenna , (b) Schematic of antenna for Assignment 6.5.
Suppose the applied torque is computed so that 𝜃 tracks a reference command
𝜃𝑟 according to the feedback law:
𝑇𝑐 = 𝐾(𝜃𝑟 − 𝜃)
1. Find the transfer function between 𝜃 and 𝜃𝑟 .
2. What is the maximum value of 𝐾 that can be used if you wish to have an OS%
< 10%?
3. What values of K will provide a rise time of less than 80 sec? (Ignore the
overshoot constraint).
4. Use MATLAB to plot the step response of the antenna system for K = 200, 400,
1000, and 2000. Find the overshoot and rise time of the four step responses
by examining your plots, and discuss the reasons for any discrepancies.

Khaled Mustafa Mahmoud Session: Spring 2017/2018


89

Assignment 6.6: A magnetic disk drive requires a motor to position a read/write


head over tracks of data on a spinning disk, as shown in Figure 6.18.

Figure 6.18: Disk drive control.

The motor and head may be represented by the transfer function:


10
𝐺(𝑠) =
𝑠(𝜏𝑠 + 1)
Where 𝜏 = 0.001 second. The controller takes the difference of the actual and
desired positions and generates an error. This error is multiplied by an
amplifier 𝐾.
Do the following:
1. What is the steady state position error for a step change in the desired input.
2. Calculate the required 𝐾 in order to yield a steady state error of 0.1 mm for
a ramp input of 10 cm/s.

Khaled Mustafa Mahmoud Session: Spring 2017/2018

You might also like