Lab1 - Intro To Simulink - 200917

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

TITLE : Introduction to Simulink – I

DATE OF
EXPERIMENT : Fall 2024

LAB NUMBER : 1

NAME :

ROLL NO :
COMMUNICATION SYSTEMS LAB (308202)

Instructions:
1. You are required to complete and submit ALL the tasks given at the end of each tutorial during
your lab timings strictly.
2. At the end of the lab manual, you will find some experiments which are required to be done as
home assignment and submitted before the next lab.
3. Please show your complete work, through Simulink models and results for both lab performance
(during lab timings) and lab report (report submitted as home assignment).
4. Save your models after performing each step to avoid loss of your work due to any reason.
Objective:
In this lab, you will learn to use and build simple models in Simulink. It is assumed that you have already
got basic knowledge of MATLAB.
1.1 Simulink:
Simulink is a dynamic system simulation environment. It allows to represent systems as block diagrams,
which you can build using your mouse to connect blocks and your keyboard to edit block parameters.
Simulink supports linear and nonlinear systems, modelled in continuous time, sampled time, or a hybrid
of the two. You can easily build models from scratch or take an existing model and add to it. Simulations
are interactive, so you can change parameters on the fly and immediately see what happens.
With Simulink, you can move beyond idealized linear models to explore more realistic nonlinear models,
factoring in friction, air resistance, gear slippage, hard stops, and the other things that describe real-world
phenomena. Simulink includes a comprehensive block library of sinks, sources, linear and nonlinear
components, and connectors. You can also customize and create your own blocks.
1.2 Working in Simulink:
Open MATLAB from your desktop and click on Simulink Model from the NEW tab.

Figure 1.1 Opening Simulink from MATLAB’s GUI

Lab #1: Introduction to Simulink – I Page 2 of 6


COMMUNICATION SYSTEMS LAB (308202)

Set Blank Model from the opened window.

Click on Library browser icon to open the Simulink library of blocks.

Drag the Simulink Library Browser and the untitled Simulink model to make them appear in parallel on
your desktop screen.

Figure 1.2 Parallel display of Simulink browser and model designing space

Some simple models are discussed below to get a head start for using Simulink.
1.3 Tutorial #1: Displaying a sine wave on oscilloscope
In this tutorial, you will learn to display a simple sine wave on oscilloscope and to explore different
parameters of Sine Wave and Scope blocks.
i. Drag a Sine Wave block from Sources Library to the blank model designing window.
ii. Drag a Scope block from Sinks Library to the window (where the Sine Wave block is already
placed).
iii. Join the two blocks with the help of mouse, by joining the arrow heads.
iv. Click on the run button on the panel of the model space.

Lab #1: Introduction to Simulink – I Page 3 of 6


COMMUNICATION SYSTEMS LAB (308202)

v. After the simulation completes, double click on the Scope icon/block to view the waveform.
vi. Open the Sine Wave block by double clicking the icon. Keeping Sine type: Time based and
Time (t): Use simulation time, explore the options of Amplitude, Bias, Frequency and Phase.
After making EACH change, click on the run button to observe the resultant waveform on
oscilloscope.
vii. Now change the Sine type: Sample based, and change the Sample Time to a non-zero value
(you should select a small integral number such as 1 to 5) to observe the changed waveform.
viii. Double click the Scope icon to open the scope window. Locate the Cursor Measurement icon on
the panel.
ix. Explore all four options of Cursor Measurement, Signal Statistics, Bilevel Measurement, and
Peak Finder.
x. From the Simulation button on model designing window, go to Model Configuration
Parameters. Change to Stop time from the default value of 10 to any other value. Check the
effect by running the simulation and observing results on scope.

Figure 1.3 An intermediate step of joining Sine Wave block to the Scope block

Task #1
i. Display 5 cycles of a sine waveform defined as 2 sin(4𝜋𝑡) on scope.
ii. What is the difference between using the Sine Wave block as (a) Time based, and (b) Sample
based?
1.4 Tutorial #2: Displaying a sine wave on spectrum analyzer
In this tutorial, you will learn to display a simple sine wave on spectrum analyzer and to explore different
parameters of Sine Wave and Spectrum Analyzer blocks.
i. Drag a Sine Wave block from Sources Library to a new blank model designing window.
ii. Drag a Spectrum Analyzer block from DSP System Toolbox/Sinks Library to the window
(where the Sine Wave block is already placed).
iii. Join the two blocks with the help of mouse, by joining the arrow heads.
iv. Double click the Sine Wave block and set Sine type: Sample based, Amplitude: 2, Bias: 0,
Samples per period: 10, and Sample Time: 1e-5. After your press OK, run your simulation.
Your display shall resemble the one displayed in Figure 1.4.
v. Now, again double click the Sine Wave block and set Sine type: Time based, Amplitude: 2,
Bias: 0, Frequency (rad/sec): 2*pi*(10e3) and Sample Time: 0. After your press OK, run your
simulation. You should receive an error about “Spectrum cannot be displayed for continuous or
Lab #1: Introduction to Simulink – I Page 4 of 6
COMMUNICATION SYSTEMS LAB (308202)

infinite sample times”. Change Sample Time: 1e-5 and re-run the simulation. You are required
to specify an appropriate sample time for spectrum analyzer to give a display.

vi. Now, click on Spectrum Settings icon on the Spectrum Analyzer display window.

vii. Under the Trace options, change Units to dBW and re-run the simulation. You can do this by
clicking the Run button on the Spectrum Analyzer display window. You can notice the
difference on vertical axis of the displayed result. Again, change Units to Watts and note the
changes in the result.
viii. Un-check the Two-sided spectrum and re-run the simulation. You should be able to see a
single sided spectrum now.

Figure 1.4 Simulink model and expected display on spectrum analyzer block after completion of step
(iv) in Tutorial #2.

Task #2
Generate a 15 kHz sine wave and display your results on Spectrum Analyzer in the Units of (a) dBm and
(b) Watts.
1.5 Tutorial #3: Adding more blocks and observing multiple waveforms
In this tutorial, you will learn to display more than one signals on scope.
Double click the Sine Wave block and set the parameters such as to develop a signal 2
sin(4𝜋𝑡)
i.

with Sample time: 1e-3. Set the Simulation stop time: 2.


ii. Double click the Scope block and from the File menu, select the input ports to be 3.
iii. Connect the Sine Wave block to first port of the Scope block (which now has three input ports).

Lab #1: Introduction to Simulink – I Page 5 of 6


COMMUNICATION SYSTEMS LAB (308202)

iv. Drag the Signal Generator block from Sources Library to model designing space. Double click
the block to select Waveform: random. Click OK and then connect the block’s output to the
second port of the Scope block.
v. From Math Operations Library, drag Add block to the model designing space. The input to the
Add block is from the Sine Wave and Signal Generator blocks. Your model should resemble as
follows:

Figure 1.5 A test design for multiple waveforms generation and observation

vi. Run your simulation and click on the Scope button to observe the output.

Scope’s panel window), go to Configuration Properties and select layout to be a “3 × 1”


vii. You should be able to view 3 overlapped signals on Scope’s display. Now, click View (on

matrix. This setting shall change Scope’s display to three separate windows.

Task #3

block and other two are produced from Signal Generator block. Assume the amplitudes to be 1, 1/3, and
Generate a sum of three sine wave signals on Scope, where one sine wave is developed from Sine Wave

1/5 respectively, and frequencies to be 1 Hz, 3 Hz, and 5 Hz respectively. Select an appropriate
Simulation stop time.

1.6 Experiments: [CLO-2; PLO-4; P4]


i. Starting from the Sine Wave block, display a COSINE wave with as many different options as
you can think of.
Define 𝑋𝑋 to be the last two digits of your registration number. Generate a sum of three sine
wave signals with amplitudes 1, 1/3, and 1/5 respectively, and frequencies 𝑋𝑋 Hz, 3 ×
ii.

𝑋𝑋 Hz, and 5 × 𝑋𝑋 Hz respectively. Display the spectrum of this summed signal.


iii. Selecting appropriate blocks from Sources and Math Operations library, display (and display
on Scope) an exponentially decaying signal.

Lab #1: Introduction to Simulink – I Page 6 of 6

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy