You are on page 1of 9

INSTITUTE OF BIOMEDICAL ENGINEERING & TECHNOLOGY

LIAQUAT UNIVERSITY OF MEDICAL AND HEALTH SCIENCES,


JAMSHORO
Subject: Signals & Systems Year: 3rd Term: 5th
Lab Handout – 10

Name: _________________________________ Roll No: ____________________

Score: __________ Signature of Tutor: ______________ Date:________________

Introduction to Simulink

Introduction:
Simulink is a software package for modeling, simulating, and analyzing dynamic systems. It
supports linear and nonlinear systems, modeled in continuous time, sampled time, or a hybrid of
the two. One can easily build, analyze and visualize models.
Thousands of engineers around the world use it to model and solve real problems. Simulink
provides a graphical user interface (GUI) for building models as block diagrams, using click-
and-drag mouse operations. With this interface, you can draw the models just as you would with
pencil and paper. Knowledge of this tool will serve you well throughout your professional career.

1. Building a model

This example shows you how to build a model using many of the model-building commands and
actions you will use to build your own models. The model integrates a sine wave and displays
the result along with the sine wave. The block diagram of the model looks like this.
To create the model, first enter Simulink in the MATLAB Command Window, or click on
Simulink which you can find on top of matlab.

The Simulink Library Browser appears.


To create a new model clicks the New Model button on the Library Browser's toolbar. Simulink
opens a new model window.

To create this model, you need to copy blocks into the model from the following Simulink block
libraries:

 Sources library (the Sine Wave block)


 Sinks library (the Scope block)
 Continuous library (the Integrator block)
 Signal Routing library (the Mux block)

To copy the Sine Wave block from the Library Browser, first expand the Library Browser tree to
display the blocks in the Sources library. Do this by clicking the Sources node to display the
Sources library blocks. Finally, click the Sine Wave node to select the Sine Wave block.
Here is how the Library Browser should look after you have done this.
Now drag a copy of the Sine Wave block from the browser and drop it in the model window.
Copy the rest of the blocks in a similar manner from their respective libraries into the model
window. With all the blocks copied into the model window, the model should look something
like this.

Now it's time to connect the blocks. Connect the Sine Wave block to the top input port of the
Mux block. Similarly connect all the components as shown in the figure. When all the blocks are
connected with each other your model should look something like this.
Now double-click the Scope block to open its display window. Finally, choose Start from the
Simulation menu and watch the simulation output on the Scope.

Example 1: Amplify sine wave using gain block

This model will takes sine wave as input and amplifies it by a factor. We need three blocks

 Sine wave block (Sources library)


 Gain block (Sources library)
 Mux (signal routing library)
 Scope (sink library)

Drag all three blocks in model window. Or, right click on the block and select “add block to
model”
Sine wave block
Sine wave block generate sine wave of default 1 amplitude and 1 frequency. To change
the sine wave parameters, double click on sine block which will open new window where
we can change the parameters. Let’s set sine wave amplitude 2 and frequency 2.

Gain block
Gain block multiply input value by factor. Let’s Change the gain value to 2 by double
clicking on gain block.

Mux
Mux is used to connect two input signals to the scope

Scope block
Scope block is most common block used for visualization.

Now it's time to connect the blocks. Connect the Sine Wave block to the input port of the Gain
block. Similarly connect all the components as shown in the figure. When all the blocks are
connected with each other your model should look something like this.

Now double-click the Scope block to open its display window. Finally, choose RUN from the
Simulation menu and watch the simulation output on the Scope.
Example 2: Integrate Step function using SIMULINK

This model will take step function as input and integrates it by an integrator block. We need four
blocks

 Step block (Sources library)


 integrator (Continuous library)
 Mux (signal routing library)
 Scope (sink library)

Drag all three blocks in model window. Or, right click on the block and select “add block to
model”. Connect the block in a similar way as shown in figure below.

Now double-click the Scope block to open its display window. Finally, choose RUN from the
Simulation menu and watch the simulation output on the Scope.

In the scope we can see step function and integral of step function which is ramp function.
Example 3: Design a block diagram of a system that inputs a step function and
outputs the same step function.

In this model we will take step fuction as input and we will first take its integration and then we
will take it differentiation which gives us same step function. We need following blocks

 Step block (Sources library)


 Integrator block (Continuous library)
 Derivative block (Continuous library)
 2x Scope (sink library)

Drag all three blocks in model window. Or, right click on the block and select “add block to
model”. Connect the block in a similar way as shown in figure below.

Now double-click the Scope block to open its display window. Finally, choose RUN from the
Simulation menu and watch the simulation output on the Scope.

Lab task 1: Perform the following tasks using SIMULINK.


a) Amplify sine wave using gain block.

b) Derivative of ramp function using SIMULINK

c) Design a block diagram of a system that inputs a ramp function and outputs
the same ramp function.
Note: show integrated and differentiated outputs on separate scopes.

You might also like