KEMBAR78
Introduction To Simulink Lab 01 | PDF | Parameter (Computer Programming) | System
0% found this document useful (0 votes)
21 views7 pages

Introduction To Simulink Lab 01

The document provides an introduction to Simulink, a graphical extension of MATLAB for simulating user-defined systems. It includes a tutorial on building a continuous-time echo system model, detailing steps for creating blocks, setting parameters, and simulating the system. Additionally, it suggests experimenting with different input signals and parameters to gain familiarity with Simulink functionalities.
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)
21 views7 pages

Introduction To Simulink Lab 01

The document provides an introduction to Simulink, a graphical extension of MATLAB for simulating user-defined systems. It includes a tutorial on building a continuous-time echo system model, detailing steps for creating blocks, setting parameters, and simulating the system. Additionally, it suggests experimenting with different input signals and parameters to gain familiarity with Simulink functionalities.
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/ 7

University College of Engineering & Technology

Department of Electronic Engineering


Control Systems
Lab-1
Introduction to Simulink

Simulink is a graphical extension to the MATLAB program that allows you to simulate the
behaviour of user-defined systems. A typical example is to determine the output signal from the
system when a specific input is applied. The overall process is shown in the figure below (both t
and n variables indicate that Simulink can be used for both continuous-time and discrete-time
systems):

Input x(t) System Output y(t)


(or x[n]) (CT or DT) (or y[n])

Tutorial: Using Simulink


To help you learn the basics of Simulink, this lab provides an example of how to define a simple
system, introduce input signals, simulate, and view output signals. A much more detailed
tutorial introduction to Simulink (aimed at students) is available at:
http://www.mathworks.com/academia/student_center/tutorials

In our example, we will implement a simple continuous-time echo system with the input/output
relation:
y( t) = x(t) + α x( t − t0 )
where x(t) is the input to the system, and y(t) is the output of the system, consisting of the sum
of the original input x(t) and an attenuated, delayed version αx( t −t0 ) (the echo). The constant
α ( 0 <α < 1) is used to determine the amount of echo suppression, and t0 is the echo delay (in
seconds). Note that the equation above defines the input/output behaviour and can be simulated for
any input signal (e.g. unit step, sinusoid, sum of sinusoids, etc.).
To build the Simulink model for this system, perform the following:

1. Launch Simulink by typing “simulink” in the MATLAB command window. The Simulink
library browser will open. This browser consists of all the graphical components (called
blocks) that can be used to define and simulate a system.

2. Create a new Simulink model file (with an extension of .mdl) into which blocks from the
library browser can be moved. This is done by selecting File -> New -> Model from the
library browser. A blank model window will open, which should then be saved as a .mdl file
(File -> Save As…).

3. The required system Simulink blocks can now be added to the model file. This is done a)
finding the appropriate block in the library browser hierarchy, and b) dragging the block
from the library browser into the model file window. For this example, you will need the
following blocks:
a. the “Sum” block (found in “Commonly Used Blocks”),
b. the “Gain” block (found in “Commonly Used Blocks”), and
c. the “Transport Delay” block (found in “Continuous”). The
model file should look like the following:

4. The required system behaviour is determined by the interconnection of the component


blocks. This is done in the model window by clicking on the input /output terminal of a
block (the “>” symbol) and dragging the resulting line to the appropriate input /output
terminal on the neighbouring block. For our system defined in the equation above, you
should verify that the connections below are appropriate.

5. Next, we need to set the correct parameters for each block in the model. Double-clicking on
the block will open a window where these parameters are specified (there are default
parameters generated when a block is created, but these, in general, need to be modified for
each system). In the transport delay block, we will change the “Time Delay” parameter to
0.1 (this represents the delay t0 in the above equation). In the gain block, we will change the
“Gain” parameter to 0.6 (this represents the α parameter in the above equation). No other
changes are needed - do not adjust any of the other settings in these windows.
6. Now that we have defined our system model, we need to introduce an input signal. In
Simulink, input signals are known as “sources” and there are several pre-defined ones in the
library browser “Sources”. Drag the “Step” block into the model and connect its output to
the model - this needs to be done in two places (note that in order to create a branched line,
you must hold the Ctrl key while creating the branch):
a. the remaining input in the “Add” block, and
b. the input on the “Transport Delay” block.
By double-clicking on the “Step” block, we can modify the parameters of the input signal.
Change the “Step Time” parameter to 0 - this creates a unit step function that turns “on” (i.e. goes
from 0 to 1) at t = 0s.

The model should now look as follows:


7. Next, we need to be able to look at the output of our system for the specified input. In
Simulink, output signals are known as “sinks” and there are several pre-defined ones in the
library browser “Sinks”. Drag the “Scope” block into the model and connect its input to the
output of the adder. It is also helpful to label signals in your model, for documentation
purposes. This can be done by double clicking in the model window and typing the label.
The following figure includes labels for input, output and intermediate signals.

8. Finally, we need to simulate the system. For our purposes, this means that we would like to
apply the input to the system for a specified amount of time. Once that input has stopped, we
would like to look at the output signal on the “Scope” block. Select Simulation ->
Configuration Parameters from the model window menu and specify the start and stop time
for the simulation. In this case, choosing start = 0s and stop = +1s will be sufficient to see
the echo effect. (As you can see from the number of options, system simulation in Simulink
can be an involved process - we are only using a tiny portion of the functionality available, so
all other options should remain unchanged from their default values). Click on the “Start
Simulation” button (arrow) on the top of the model window. After a brief pause (ignore any
warnings generated in the MATLAB command window), the output signal will be visible in a
new Scope window that results from double clicking on the “Scope” block. You should see
something like the following (the artefact at t = 0.1s due to the echo is clearly evident):

Sometimes it is helpful to plot multiple signals (e.g. both input and output) in a single scope.
This can be done by clicking on the “Parameters” button on the top of the Scope window,
then specifying the “Number of Axes” = 2. In the model file, this will generate another
Scope block input which can then be connected to any other signal in the system. In the
figure below, it is connected to the input (which appears on the bottom scope graph).

Re-running the simulation generates a scope output showing the difference between input
and output:

After saving your model, try the following in order to gain familiarity with Simulink models.
After each change, re-run the simulation and see if the results you see at the scope output are as
expected:
• try another input signal (instead of a step), for example a “sine wave” function
• vary the frequency of the sine wave
• vary the echo delay parameter t0 and the echo suppression parameter α
• simulate for different start and stop times

The following are handy tricks to keep in mind while performing these experiments:
• the scope output can be “autoscaled” by right-clicking in the scope plot area and selecting
“Autoscale”
• the scope y-axis limits can be specified by right-clicking in the scope plot area and
selecting “Axes Properties”
Simulation of a simple system
Implement the following continuous-time system with a Simulink model:
y(t) = 0 2x(t) + 0 8x(t − 2) − 0 4x( t − 5)
Simulate the system between t = 0s and t = 10s with the following inputs:
[1] x(t) = u(t) (Unit step)
[2] x(t) = 2 5sin(3π t)
Submit two .mdl files electronically - one with the unit step signal connected to the system input
and the other with the sinusoidal signal connected to the system input.

You might also like