Control Lab 3
Control Lab 3
EXPERIMENT NO. 3
(2020-2021)
TIME RESPONSE
1. OBJECTIVE:
1.1. To develop the skill of analyzing control systems using MATLAB/SIMULINK
1.2. To understand the dynamic response of first and second order system.
2. INTRODUCTION
2.1 Introduction to MATLAB Simulink
Simulink is an extension to Matlab which uses an icon-driven interface for the
construction of a block diagram representation of a process. It is a dynamic simulation
package that allows the user to specify a block diagram representation of a dynamic
process. Simulink uses a graphical user interface (GUI) for solving process simulations.
Model Files
In Simulink, a model is a collection of blocks which, in general, represents a system. In
addition, to drawing a model into a blank model window, previously saved model files
can be loaded either from the File menu or from the MATLAB command prompt.
Basic Elements
There are two major classes of items in Simulink: blocks and lines. Blocks are used to
generate, modify, combine, output, and display signals. Lines are used to transfer signals
from one block to another.
Blocks
There are several general classes of blocks:
• Sources: Used to generate various signals
• Sinks: Used to output or display signals
• Discrete: Linear, discrete-time system elements (transfer functions, state-space models,
etc.)
• Linear: Linear, continuous-time system elements and connections (summing junctions,
gains, etc.)
• Nonlinear: Nonlinear operators (arbitrary functions, saturation, delay, etc.)
• Connections: Multiplex, Demultiplex, System Macros, etc.
1
Blocks have zero to several input terminals and zero to several output terminals. Unused
input terminals are indicated by a small open triangle. Unused output terminals are
indicated by a small triangular point. The block shown below has an unused input
terminal on the left and an unused output terminal on the right.
Lines
Lines transmit signals in the direction indicated by the arrow. Lines must always
transmit signals from the output terminal of one block to the input terminal of another
block. On exception to this is a line can tap off of another line, splitting the signal to
each of two destination blocks, as shown below;
Lines can never inject a signal into another line; lines must be combined through the use
of a block such as a summing junction.
Modifying Blocks
A block can be modified by double-clicking on it. For example, if you double-click on
the "Transfer Fcn" block in the simple model, you will see the following dialog box.
2
This dialog box contains fields for the numerator and the denominator of the block's
transfer function. By entering a vector containing the coefficients of the desired
numerator or denominator polynomial, the desired transfer function can be entered. For
example, to change the denominator to s^2+2s+4, enter the following into the
denominator field:
[1 2 4]
and hit the close button, the model window will change to the following, which reflects
the change in the denominator of the transfer function.
The "step" block can also be double-clicked, bringing up the following dialog box.
The default parameters in this dialog box generate a step function occurring at time=1
sec, from an initial level of zero to a level of 1. (in other words, a unit step at t=1). Each
of these parameters can be changed. Close this dialog before continuing.
3
The most complicated of these three blocks is the "Scope" block. Double clicking on this
brings up a blank oscilloscope screen. When a simulation is performed, the signal which
feeds into the scope will be displayed in this window.
Time constant (1/a), is defined as the time for e-at to decay to 37%of its initial value or
the time it takes for step response to reach 63% of its final value.
4
Figure 2.1:First Order Response to a Unit Step
5
2.2.2 Second Order System
6
The amount that the waveform overshoots the steady-state, or final, value at peak time,
expressed as a percentage of the steady-state value.
2.3.4 Settling Time, Ts
The time required for the transient’s damped oscillations to reach and stay within ±2%
of the steady-state value.
2.4 Electrical network transfer function
3.
PROCEDURE 3.1. Click the Matlab Shortcut button at the desktop.
3.2. Click the New Simulink Model button at the top of the MATLAB command
window as shown below:
7
3.3. When it starts, Simulink brings up Simulink Library Browser window, which
appears as:
3.4.
Create a new model by selecting New from the File menu in any Simulink window (or
by hitting Ctrl+N). This is the window into which a new model can be drawn.
Task 1
3.5. Task 1: Draw a model consists of three blocks: Step, Transfer Fcn, and Scope as
shown below. (The Step is a source block from which a step input signal originates.
This signal is transferred through the line in the direction indicated by the arrow to the
Transfer Function linear block. The Transfer Function modifies its input signal and
8
outputs a new signal on a line to the Scope. The Scope is a sink block used to display a
signal much like an oscilloscope.)
3.6. Click ‘step’ on the Simulink Library Browser window. Drag the ‘step’ icon into the
new model window.
3.7. Click ‘transfer fcn’ on the Simulink Library Browser window. Drag the ‘transfer
fcn’ icon into the same window.
3.8. Click ‘scope’ on the Simulink Library Browser window. Drag the ‘scope’ icon into
the same window.
3.9. Connect the step and transfer function with a line. Connect transfer function and
scope with another line.
3.10. Run the simulation by clicking ‘start simulation’ button. Double click on ‘scope’
icon to show the signal. From the graph, plot time constant T, settling time T, and rise
time T.csr
Solution:
9
3.11. Repeat the steps 3.5 to 3.10 for the following transfer functions and draw the
signals produced. Plot the poles and zeros for the system. Evaluate the percent overshoot
%OS, settling time T, peak time T, and rise time T.
10
Task 2
4.
4.1 Use New Simulink Model and Program Code in M-File to plot the capacitor
voltage for the following transfer function:
11
4.2 Consider the following second order closed-loop system:
12
Figure 4.2: System Showing input and output
Note that
τ =7
and
ζ= 5.0
Obtain the unit-STEP and RAMP for this system using simulink.
13
0.78⁄
49
a- G(s) = (49𝑠2+7𝑠+1)
⁄49
0.0159
G(s) =
𝑠 2 +0.142𝑠+0.0204
𝑘·𝑤𝑛
G(s) =
𝑠 +2·𝜁·𝑤𝑛 ·𝑠+𝑤𝑛 2
2
τ=7
wn2 = 0.0204
1 1
wn = = = 0.142
𝜏 7
K* wn = 0.0159 k = 0.1119
i. ζ=1
0.0159
G(s) =
𝑠 2 +0.142𝑠+0.0204
τ=7
wn2 = 0.0204
1 1
wn = = = 0.142
𝜏 7
K* wn = 0.0159
ζ=1
2·ζ·wn = (2) (1) (0.142) = 0.284
𝑘·𝑤𝑛
G(s) =
𝑠 +2·𝜁·𝑤𝑛 ·𝑠+𝑤𝑛 2
2
(0.0159)·(49)
G(s) =
(𝑠 2 +0.284𝑠+0.0204)·(49)
0.7791
G(s) =
49𝑠 2 +13.916𝑠+1
>> s=tf('s')
s=
14
s
15
>> plot(r)
ii. ζ>1
0.0159
G(s) =
𝑠 2 +0.142𝑠+0.0204
τ=7
wn2 = 0.0204
1 1
wn = = = 0.142
𝜏 7
K* wn = 0.0159
ζ=3
2·ζ·wn = (2) (3) (0.142) = 0.852
16
𝑘·𝑤𝑛
G(s) =
𝑠 +2·𝜁·𝑤𝑛 ·𝑠+𝑤𝑛 2
2
(0.0159)·(49)
G(s) =
(𝑠 2 +0.852𝑠+0.0204)·(49)
0.7791
G(s) =
49𝑠 2 +41.748𝑠+1
>> s=tf('s')
s=
s
Continuous-time transfer function.
>> G=(0.7791)/(49*s^2+41.748*s+1)
G=
0.7791
--------------------
49 s^2 + 41.75 s + 1
Continuous-time transfer function.
>> den=[49 41.748 1]
den =
49.0000 41.7480 1.0000
>> r=roots(den)
r=
-0.8273
17
-0.0247
iii. 0<ζ<1
0.0159
G(s) =
𝑠 2 +0.142𝑠+0.0204
τ=7
wn2 = 0.0204
1 1
wn = = = 0.142
𝜏 7
K*
wn
=
0.0159
ζ = 0.7
2·ζ·wn = (2) (0.7) (0.142) = 0.1988
18
𝑘·𝑤𝑛
G(s) =
𝑠 +2·𝜁·𝑤𝑛 ·𝑠+𝑤𝑛 2
2
(0.0159)·(49)
G(s) =
(𝑠 2 +0.1988𝑠+0.0204)·(49)
0.7791
G(s) =
49𝑠 2 +9.7412𝑠+1
>> s=tf('s')
s=
s
Continuous-time transfer function.
>> G=(0.7791)/(49*s^2+9.7412*s+1)
G=
0.7791
--------------------
49 s^2 + 9.741 s + 1
Continuous-time transfer function.
>> den=[49 9.7412 1]
den =
49.0000 9.7412 1.0000
>> r=roots(den)
r=
-0.0994 + 0.1026i
19
-0.0994 - 0.1026i
iv. ζ=0
0.0159
G(s) =
𝑠 2 +0.142𝑠+0.0204
τ=7
wn2 = 0.0204
wn
1
=
𝜏
1
=
7
=
0.142
K* wn = 0.0159
ζ=0
20
2·ζ·wn = (2) (0) (0.142) = 0
𝑘·𝑤𝑛
G(s) =
𝑠 +2·𝜁·𝑤𝑛 ·𝑠+𝑤𝑛 2
2
(0.0159)·(49)
G(s) =
(𝑠 2 +0.0204)·(49)
0.7791
G(s) =
49𝑠 2 +1
>> s=tf('s')
s=s
>> G=(0.7791)/(49*s^2+0*s+1)
G=
0.7791
----------
49 s^2 + 1
>> den=[49 1]
den =
49 1
21
>> r=roots(den)
r=
-0.0204
22
b- 0 < ζ < 1
τ=1
1 1
wn = = = 1
𝜏 1
K* wn = 0.0159 k = 0.0159
ζ = 0.7
2·ζ·wn = (2) (0.7) (1) = 1.4
𝑘·𝑤𝑛
G(s) =
𝑠 +2·𝜁·𝑤𝑛 ·𝑠+𝑤𝑛 2
2
(0.0159)·(49)
G(s) =
(𝑠 2 +1.4𝑠+0.0204)·(49)
0.7791
G(s) =
49𝑠 2 +68.6𝑠+1
>> G=(0.7791)/(49*s^2+68.6*s+1)
G=
0.7791
-------------------
49 s^2 + 68.6 s + 1
Continuous-time transfer function.
>> den=[49 68.6 1]
den =
49.0000 68.6000 1.0000
>> r=roots(den)
r=
-1.3853
-0.0147
τ=7
23
wn2 = 0.0204
1 1
wn = = = 0.142
𝜏 7
K* wn = 0.0159 k = 0.1119
ζ = 0.7
2·ζ·wn = (2) (0.7) (0.142) = 0.1988
𝑘·𝑤𝑛
G(s) =
𝑠 +2·𝜁·𝑤𝑛 ·𝑠+𝑤𝑛 2
2
(0.0159)·(49)
G(s) =
(𝑠 2 +0.1988𝑠+0.0204)·(49)
0.7791
G(s) =
49𝑠 2 +9.7412𝑠+1
>> G=(0.7791)/(49*s^2+9.7412*s+1)
G=
0.7791
--------------------
49 s^2 + 9.741 s + 1
Continuous-time transfer function.
>> den=[49 9.7412 1]
den =
49.0000 9.7412 1.0000
>> r=roots(den)
r=
-0.0994 + 0.1026i
-0.0994 - 0.1026i
τ = 10
wn2 = 0.0204
1 1
wn = = = 0.1
𝜏 10
24
K* wn = 0.0159 k = 0.159
ζ = 0.7
2·ζ·wn = (2) (0.7) (0.1) = 0.14
𝑘·𝑤𝑛
G(s) =
𝑠 +2·𝜁·𝑤𝑛 ·𝑠+𝑤𝑛 2
2
(0.0159)·(49)
G(s) =
(𝑠 2 +0.14𝑠+0.0204)·(49)
0.7791
G(s) =
49𝑠 2 +6.86𝑠+1
>> G=(0.7791)/(49*s^2+6.86*s+1)
G=
0.7791
-------------------
49 s^2 + 6.86 s + 1
Continuous-time transfer function.
>> den=[49 6.86 1]
den =
49.0000 6.8600 1.0000
>> r=roots(den)
r=
-0.0700 + 0.1245i
-0.0700 - 0.1245i
25