Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 26

Laboratory Exercise No.

6
Time Responses of Dynamic Systems Using Matlab Simulink

1. Objective:
The activity aims to understand the different time responses of dynamic systems using matlab simulink.

2. Intended Learning Outcomes (ILOs):


The students shall be able to:
2.1 determine the different responses of dynamic systems using matlab simulink.

3. Discussion:
A dynamic system is a system in which a function describes the time dependence of a point in
a geometrical space. Examples include the mathematical models that describe the swinging of a
clock pendulum, the flow of water in a pipe, and the number of fish each springtime in a lake.
The time response represents how the state of a dynamic system changes in time when subjected
to a particular input. Since the models consist of differential equations, some integration must be performed
in order to determine the time response of the system. For some simple systems, a closed-form analytical
solution may be available. However, for most systems, especially nonlinear systems or those subject to
complicated input forces, this integration must be carried out numerically. Fortunately, MATLAB provides
many useful resources for calculating time responses for many types of inputs.
The time response of a linear dynamic system consists of the sum of the transient response which
depends on the initial conditions and the steady-state response which depends on the system input. These
correspond to the free (homogeneous or zero input) and the forced (inhomogeneous or non-zero input)
solutions of the governing differential equations respectively.
Simulink, developed by MathWorks, is a graphical programming environment for modeling,
simulating and analyzing multidomain dynamic systems. Its primary interface is a graphical block
diagramming tool and a customizable set of block libraries. Visual modeling is the graphic representation of
objects and systems of interest using graphical languages.
4. Resources:
Matlab
5. Procedure:
1. To start Simulink from the Matlab IDE, select the Simulink Icon in the toolbar to open the
Simulink Start Page. Click a blank model.
2. Open Simulink Library Browser by clicking Tools and choosing Library Browser. Click
Commonly Used Blocks. Enumerate the different commonly used blocks and identify the
function of each block. Show your answers in Data and Results.
3. Click Continuous . Enumerate the different blocks under Continuous and identify the function of
each block. Show your answers in Data and Results.

1
4. Click Discrete . Enumerate the different blocks under Discrete and identify the function of each
block. Show your answers in Data and Results.
5. Click Sinks . Enumerate the different blocks under Sinks and identify the function of each block.
Show your answers in Data and Results.
6. Click Sources. Enumerate the different blocks under Sources and identify the function of each
block. Show your answers in Data and Results.
7. To determine the step response of the system

The input u is the step block from sources. Drag and drop this step block to the Simulink window. The
transfer function block can be taken from Continuous blocks. Drag and drop two transfer function
blocks and specify the numerical coefficients of the numerator and denominator of the two transfer
functions by double clicking the transfer function blocks. The output y can be determined by using
Scope block which can be taken from Sinks blocks. Drag and drop Scope block to the Simulink window.
Connect them. It should look like this in the Simulink window:

Click the run button and when it is ready, double click the Scope. Save the simulation with the
filename yourSurnameSimPro7. Show the time response of the system in Data and Results.
Compare the results of the previous activity. Are the results the same ?
8. Using following dynamic systems, simulate each of them. Show the assembled blocks and the
result of each simulation. Use step block as the input to the system. Save the simulation using
file names as yourSurnameMatlabExer02Proc8a to yourSurnameMatlabExer02Proc8e.

2
c

9. Repeat Procedure 8 using ramp block as input. Save the simulation using file names as
yourSurnameMatlabExer02Proc9a to yourSurnameMatlabExer02Proc9e
10. Using the dynamic systems in Procedure 9, reduce each of them into a single block and
simulate each of them.
a. Use step block as the input to the system. Save the simulation using file names as
yourSurnameMatlabExer02Proc10Partaa to yourSurnameMatlabExer02Proc10Partae.
b. Use ramp block as the input to the system. Save the simulation using file names as
yourSurnameMatlabExer02Proc8Partba to yourSurnameMatlabExer02Proc8Partbe

3
Course: Laboratory Exercise No.
Group No.: Section:
Group Members: Date Performed:
Date Submitted:
Instructor:

6. Data and Results:


Procedure 2
Table of Commonly Used Blocks
Name of the Block Image of the Block Function
1. Bus Creator This block creates a bus signal
from its inputs. The Bus Creator
block combines a set of signals
into a bus, i.e., a group of signals
represented by a single line in a
block diagram. The Bus Creator
block, when used in conjunction
with the Bus Selector block,
allows you to reduce the number
of lines required to route signals
from one part of a diagram to
another.
2. Bus Selector The Bus Selector block outputs a
specified subset of the elements
of the bus at its input. The block
can output the specified elements
as separate signals or as a new
bus.
3. Constant The Constant block generates a
real or complex constant value.
The constant output value is
displayed in the middle of the
block, with a default value of 1.
4. Data Type Conversion The Data Type Conversion block
converts an input signal of any
Simulink data type to the data
type you specify for the Output
data type parameter. The input
can be any real- or complex-
valued signal.
5. Delay The Delay block delays an input u
according to the Delay length
parameter, which you specify on
the dialog box, or a delay length
that a signal supplies to the input
4
port. This block is equivalent to
the z-1 discrete-time operator.
6. Demux The Mux (Multiplexer) block is
used to combine two or more
scalar signals into a single vector
signal. Similarly, a Demux
(Demultiplexer) block breaks a
vector signal into scalar signal
components. The number of
vector components must be
specified in each case.
7. Discrete-Time Integrator This is the discrete time
approximation of a continuous-
time integrator. The
approximation method can be
specified as well as the initial
condition and saturation limits.
8. Gain The Gain block multiplies the
input by a constant value (gain).
The input and the gain can each
be a scalar, vector, or matrix.
9. Ground The Ground block connects to
blocks whose input ports do not
connect to other blocks.
10. In1 Inport blocks are the links from
outside a system into the system.
11. Integrator The output of the Integrator is the
integral of the input. An initial
condition can be specified, as well
as saturation limits. This block is
very useful for modeling system in
Simulink.
12. Logical Operator The Logical Operator block
performs the specified logical
operation on its inputs. An input
value is TRUE (1) if it is nonzero
and FALSE (0) if it is zero.
13. Mux The Mux (Multiplexer) block is
used to combine two or more
scalar signals into a single vector
signal. Similarly, a Demux
(Demultiplexer) block breaks a
vector signal into scalar signal
components. The number of

5
vector components must be
specified in each case
14. Out1 Outport blocks are the links from
a system to a destination outside
the system.
15. Product By default, the Product block
outputs the result of multiplying
two inputs: two scalars, a scalar
and a nonscalar, or two
nonscalars that have the same
dimensions.
16. Relational Operator By default, the Relational
Operator block compares two
inputs using the Relational
operator parameter that you
specify. The first input
corresponds to the top input port
and the second input to the
bottom input port.
17. Saturation The Saturation block imposes
upper and lower limits on an input
signal.
18. Scope The Scope block displays inputs
signals with respect to simulation
time.
19. Subsystem A Subsystem block represents a
subsystem of the system that
contains it. The Subsystem block
can represent a virtual subsystem
or a nonvirtual subsystem.
20. Sum The Sum block performs addition
or subtraction on its inputs. This
block can add or subtract scalar,
vector, or matrix inputs. It can also
collapse the elements of a signal.
21. Switch The Switch block passes through
the first input or the third input
based on the value of the second
input. The first and third inputs are
called data inputs. The second
input is called the control input.
22. Terminator Use the Terminator block to cap
blocks whose output ports do not
connect to other blocks.

6
23. Vector Concatenate The Concatenate block
concatenates the signals at its
inputs to create an output signal
whose elements reside in
contiguous locations in memory.

Procedure 3
Continuous
Name of the Block Image of the Block Function
1. Derivative The output is equal to the
derivative of the input.

2. Integrator The Integrator block outputs the


integral of its input at the current
time step.

3. Integrator, Second Order The Second-Order Integrator


block and the Second-Order
Integrator Limited block solve the
second-order initial value
problem: where u is the input to
the system. The block is therefore
a dynamic system with two
continuous states: x and dx/dt
4. Integrator, Second Order The Second-Order Integrator
Limited block and the Second-Order
Integrator Limited block solve the
second-order initial value problem

5. Integrator Limited The Integrator Limited block is


identical to the Integrator block
with the exception that the output
of the block is limited based on
the upper and lower saturation
limits.

7
6. PID Controller The PID Controller block output is
a weighted sum of the input
signal, the integral of the input
signal, and the derivative of the
input signal. The weights are the
proportional, integral, and
derivative gain parameters.
7. PID Controller (2DOF) The PID Controller (2DOF) block
generates an output signal based
on the difference between a
reference signal and a measured
system output.
8. State-Space A, B, C, and D matrices can be
specified to create a LTI state
space system. Inputs and outputs
may be vector signals depending
on the sizes of the matrices.
9. Transfer Function Numerator and denominator
polynomials can be specified to
create a standard SISO LTI
system transfer function.
10. Transport Delay The Transport Delay block delays
the input by a specified amount of
time. You can use this block to
simulate a time delay. The input to
this block should be a continuous
signal.
12. Variable Time Delay, The Variable Transport Delay and
Variable Transport Delay Variable Time Delay appear as
two blocks in the Simulink block
library. However, they are the
same Simulink block with different
settings of a Select delay type
parameter. Use this parameter to
specify the mode in which the
block operates.
13. Zero-Pole The Zero-Pole block models a
system that you define with the
zeros, poles, and gain of a
Laplace-domain transfer function.
This block can model single-input
single output (SISO) and single-
input multiple-output (SIMO)
systems.
8
Procedure 4
Discrete
Name of the Block Image of the Block Function
1. Delay Delay input signal by fixed or
variable sample periods

2. Difference The Difference block outputs the


current input value minus the
previous input value.

3. Discrete Derivatives The Discrete Derivative block


computes an optionally scaled
discrete time derivative.

4. Discrete Filter This is a discrete-time filter in


rational function form. Vectors
containing coefficients of the
polynomials in z^-1 are specified.

5. Discrete FIR Filter The Discrete FIR Filter block


independently filters each
channel of the input signal with
the specified digital FIR filter. The
block can implement static filters
with fixed coefficients, and time-
varying filters with coefficients
that change over time.
6. Discrete PID Controller The Discrete PID Controller block
output is a weighted sum of the
input signal, the discrete-time
integral of the input signal, and
the discrete-time derivative of the
input signal. The weights are the
proportional, integral, and
derivative gain parameters.

9
7. Discrete PID Controller The Discrete PID Controller
(2DOF) (2DOF) block generates an
output signal based on the
difference between a reference
signal and a measured system
output.
8. Discrete State-Space This is a discrete-time dynamic
system in state-space form. A, B,
C, and D matrices can be
specified, as well as initial
conditions.
9. Discrete-Time Integrator The output of this block is the
discrete-time integration of the
input signal. The integration
methods can be Forward Euler,
Backward Euler, etc
10. Discrete-Transfer Fcn This is the standard form of a
SISO LTI discrete time system.
The transfer function polynomials
are represented as coefficient
vectors in terms of z.
11. Discrete Zero-Pole A discrete-time transfer function
can be represented as list of z-
plane poles and zeros. The gain
can also be specified.

12. Enabled Delay This block delays the input signal


by a specified number of samples.
The block is considered enabled
when the input to the enable port
is nonzero, and is disabled when
the input is 0.
13. First-Order Hold The First-Order Hold block
implements a first-order sample-
and-hold that operates at the
specified sampling interval. This
block has little value in practical
applications and is included
primarily for academic purposes.

10
14. Memory The Memory block holds and
delays its input by one integration
time step. This block accepts and
outputs continuous signals. The
block accepts one input and
generates one output. Each
signal can be scalar or vector.
15. Resettable Delay The Resettable Delay block
delays the input signal by a
variable sample period and resets
with external signal.

16. Tapped Delay The Tapped Delay block delays


an input by the specified number
of sample periods and outputs all
the delayed versions. Use this
block to discretize a signal in time
or resample a signal at a different
rate.
17. Transfer Fcn First Order The Transfer Fcn First Order
block implements a discrete-time
first order transfer function of the
input. The transfer function has a
unity DC gain.

18. Transfer Fcn Lead or Lag The Transfer Fcn Lead or Lag
block implements a discrete-time
lead or lag compensator of the
input. The instantaneous gain of
the compensator is one, and the
DC gain is equal to (1-z)/(1-p),
where z is the zero and p is the
pole of the compensator.
19. Transfer Fcn Real Zero The Transfer Fcn Real Zero block
implements a discrete-time
transfer function that has a real
zero and effectively no pole.

20. Unit Delay The Unit Delay block delays its


input by the specified sample
period. This block is equivalent to
the z-1 discrete-time operator.

11
21. Variable Integer Delay The Variable Integer Delay block
delays the input signal by a
variable sample period.

22. Zero-Order Hold The Zero-Order Hold block holds


its input for the sample period you
specify. The block accepts one
input and generates one output.
Each signal can be scalar or
vector.

Procedure 5
Sinks
Name of the Block Image of the Block Function of the Block
1. Display The Display Sink Block is a digital
readout of a signal at the current
simulation time.

2. Floating Scope Display signals generated during


simulation without signal lines

3. Out Bus Element The Out Bus Element block


specifies an element of a bus (or
entire bus) for the output port of
the subsystem.
4. Out1 A linear model of the system (in
state space or transfer function
form) can be extracted from a
Simulink model into MATLAB.
This is done through the use of
In1 and Out1 blocks
5. Scope The Scope Sink Block was
described earlier. It is used to
display a signal as a function of
time.

12
6. Stop Simulation This is a special control block
which is triggered to stop the
current simulation when its input
is non-zero.

7. Terminator Used to terminate output signals.

8. To File The To File Sink Block saves a


signal to a .mat file in the same
way that the From File Source
Block reads from a file. The
sampling time can be specified,
but is not necessary.
9. To Workspace The To Workspace Sink Block
stores a signal in a specified
workspace variable. Unlike the To
File Sink Block, the time is not
saved in the variable, and must be
stored separately.
10. XY Graph The XY Graph Sink Block plots
one signal against another. It is
useful for phase-plane plots, etc.

Procedure 6
Sources
Name of the Block Image of the Block Function of the Block
1. Band-Limited White Noise The Band-Limited White Noise
Source Block generates a
random signal which changes at a
specified sample period. The
strength of the signal and a
random number seed can also be
specified.
2. Chirp Signal The Chirp Signal Source Block
generates a sinusoidal signal
which scans over a range of
frequencies. The initial and final
frequencies as well as the scan
13
time can be specified. The
amplitude is always 1, and the
chirp signal repeats itself after
each frequency scan.
3. Clock The Clock Source Block
generates a signal equal to the
current time in the simulation.
This is useful when the output of
a simulation is exported to
MATLAB but occurs at uneven
time steps. The clock's output
reflects the times at which the
other signals outputs occur.
4. Constant Generate constant value

5. Counter Free-Running The Counter Free-Running block


counts up until reaching the
maximum value,
, where Nbits is
the number of bits. Then the
counter overflows to zero and
begins counting up again.
6. Counter Limited The Counter Limited block counts
up until the specified upper limit is
reached. Then the counter wraps
back to zero, and restarts
counting up.
7. Digital Clock The Digital Clock Source Block
generates a strictly periodic time
signal at a specified sampling
interval.
8. Enumerated Constant The Enumerated Constant block
outputs a scalar, array, or matrix
of enumerated values.

14
9. From File The From File Source Block
outputs a signal taken from a
specified .mat file. A matrix saved
in MATLAB as a .mat file will
become a signal where the first
row of the matrix specifies the
time values. This is similar to the
Repeating Sequence Source
Block.
10. From Spreadsheet The block reads data values from
a spreadsheet. It interprets the
first column as time and the first
row and the remaining columns
as signals.
11. From Workspace The From Workspace Source
Block is identical to the From File
Source Block except the values
are taken from a variable (or
expression) in the MATLAB
Workspace.
12. Ground Ground unconnected input port

13. In Bus Element The block selects an element


from a bus (or the entire bus) that
is connected to the input port of
the subsystem.
14. In1 Inport blocks are the links from
outside a system into the system.
14. Pulse Generator The Pulse Generator Source
Block generates a pulse train of
varying duty cycle. The signal
switches between 0 and the
specified value starting at a
particular time. The Period, Duty
Cycle, Amplitude, and Start Time
can be specified.

15
15. Ramp The Ramp Source Block
generates a signal which is
initially constant and begins to
increase (or decrease) at a
constant rate at a specified time.
The slope, start time, and initial
output can be specified.
16. Random Number The Random Number Source
Block generates a sequence of
random numbers generated with
the specified random number
seed. Because of the seed, the
same sequence can be applied to
more than one simulation.
17. Repeating Sequence An arbitrary set of points (t,y) can
be specified. These points are
entered as a vector specifying the
time values, and a vector
specifying the corresponding
output values at those times. The
output is linearly interpolated
between the specified time
values. At the last time value, the
output immediately starts over,
possibly with a discontinuous
transition.
18. Repeating Sequence The Repeating Sequence
Interpolated Interpolated block outputs a
discrete-time sequence and then
repeats it.

19. Repeating Sequence Stair The Repeating Sequence Stair


block outputs and repeats a stair
sequence that you specify with
the Vector of output values
parameter.

20. Signal Builder Create and generate


interchangeable groups of signals
whose waveforms are picewise
linear.

16
21. Signal Editor Create and edit input signals that
you can organize for multiple
simulations

22. Signal Generator The Signal Generator Source


Block is a general-purpose
source which encompasses some
of the other blocks' functions. It
generates periodic waveforms
such as sine, square, and
sawtooth waves as well as a
random signal. Drag this block
from the Sources window to your
model window.
23. Sine Wave The Sine Wave Source Block
generates a sinusoidal signal.
The Amplitude and Frequency
can be specified, as well as the
Phase (unlike the Signal
Generator). There is a fourth
parameter, the Sample Time,
which can be used to force the
Sine Wave Source to operate in
discrete-time mode.
24. Step As described earlier, the Step
Source Block generates a step
function. The initial and final
values can be specified, as well
as the step time.
25. Uniform Random Number The Uniform Random Number
block generates uniformly
distributed random numbers over
an interval that you specify.

17
Procedure 7

The results showed a different graph curve compared to the previous experiment. This graph shows a
slightly curvy line wherein the previous graph appears to have parabolic curve.

Procedure 8

Procedu Assembled Blocks in Simulation Window Step Response


re
8a

18
8b

8c

8d

8e

19
Procedure 9

Proced Assembled Blocks in Simulation Window Ramp Response


ure
9a

9b

9c

9d

20
9e

Procedure 10 Part a

Procedure Single Block in Simulation Window Step Response


10a

10b

10c

21
10d

10e

Procedure 10 Part b

Procedure Single Block in Simulation Window Ramp Response


10a

10b

22
10c

10d

10e

7. Conclusion:

I therefore conclude that Simulink library is a big help to familize students with different
commonly used blocks giving them knowledge on how to use these blocks to create linear dynamic system
and transfer functions. The simulink library thus, makes it easier for modeling, simulating and analyzing
multidomain dynamic systems.

8. Further Readings:
Ferraris, G. and Manenti, F. (2010). Interpolation and regression models for the chemical engineer:
solving numerical problems. Germany: Wiley-VCH Verlag
Filo, O. (2010). Information processing by biochemical systems: neural network type configurations.
New Jersey: Wiley.
Gopal, S. (2009). Bioinformatics: a computing perspective. India: McGraw-Hill Science/Engineering
Math.
Jaluria, Y. (2012). Computer methods for engineering with MATLAB applications (2 nd ed.). Boca,
Raton,Florida: CRC Press.

23
Knopf, F. C. (2012). Modeling, analysis and optimization of process and energy systems.Hoboken,
New Jersey: John Wiley and Sons.
Velten, K. (2009). Mathematical modeling and simulation: introduction for scientists and engineers.
Singapore: Wiley-VCH.

24
9. Assessment (Rubric for Laboratory Performance):
TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES
RUBRIC FOR MODERN TOOL USAGE
(Engineering Programs)
Student Outcome (e): Use the techniques, skills, and modern engineering tools necessary for engineering
practice in complex engineering activities.
Program: Chemical Engineering Course: ECE 006 Section: CH42FB2 2nd Sem SY 2018-2019
Performance Unsatisfactory Developing Satisfactory Very Satisfactory Score
Indicators 1 2 3 4
1. Apply Fails to identify Identifies Identifies modern Recognizes the
appropriate any modern modern techniques and is benefits and
techniques, techniques to techniques but able to apply constraints of
skills, and perform fails to apply these in modern
modern discipline- these in performing engineering tools
tools to specific performing discipline-specific and shows
perform a engineering discipline- engineering task. intention to apply
discipline- task. specific them for
specific engineering engineering
engineering task. practice.
task.
2. Demonstrate Fails to apply Attempts to Shows ability to Shows ability to
skills in any modern apply modern apply fundamental apply the most
applying tools to solve tools but has procedures in appropriate and
different engineering difficulties to using modern effective modern
techniques problems. solve tools when solving tools to solve
and modern engineering engineering engineering
tools to problems. problems. problems.
solve
engineering
problems.
3. Recognize Does not Recognizes Recognizes the Recognizes the
the benefits recognize the some benefits benefits and need for benefits
and benefits and and constraints of and constraints of
constraints constraints of constraints of modern modern
of modern modern modern engineering tools engineering tools
engineering engineering engineering and shows and makes good
tools. tools. tools. intention to apply use of them for
them for engineering
engineering practice.
practice. Total Score

Mean Score = (Total Score / 3)

Percentage Rating = (Total Score / 12) x 100%

Evaluated by: ENGR. CRISPULO MARANAN JANUARY 19, 2019


Printed Name and Signature of Faculty Member Date
25
26

You might also like