You are on page 1of 9

[MECH662-matlab]

1
[Introduction to matlab programming]

Module 4<Topic 1>< Matlab Simulation on Filters


Course Learning Outcomes:
C7. Use communication toolbox and programming with wireless communication and computation
platforms to evaluate the appropriateness of scripting and simulations
C8. With less supervision, collaborate work with a group to develop and communicate reasonable
recommendations for the script debugging.

Activity 1 : Matlab Simulation on Filters


In this experiment, you will learn how to represent, manipulate, and analyze a filtering process using
simulink

1. to study how to construct a simulink model in matlab

2. to study the MATLAB Blocks required to create the model for filters
Low Pass Filter
3. to use plot to plot the filtered output of wireless signals

Introduction
𝑅
From the previous lecture, for LPF:
𝑓 𝑉

Using voltage divider rule:


𝐶 𝑉

𝑋
𝑉 𝑉
𝑋𝑐 𝑅
So,
𝑉 𝑋
𝑉 𝑋 𝑅

Where,
Course Module
1 1
𝑋
𝑗2𝜋𝑓𝐶 𝑗𝜔𝐶
In Matlab we represent 𝑗𝜔 𝑠
So,

𝑉 𝑗𝜔
𝑉 𝑗𝜔 𝑅

Which is,

𝑉 𝑠 𝑠𝐶
𝑉 𝑠 𝑅 𝑠𝐶

1
1 𝑠𝑅𝐶
Where,
𝑅𝐶is the time constant 𝑇
So, the transfer function of the LPF is:

High Pass Filter


From the previous lecture, for HPF:
𝑓
Using voltage divider rule:
𝑅 𝐶
𝑉 𝑉
𝑋𝑐 𝑅
So,
𝑉 𝑅 𝑉
𝑉 𝑋 𝑅

𝑅 𝑉
Where,
1 1
𝑋
𝑗2𝜋𝑓𝐶 𝑗𝜔𝐶

In Matlab we represent 𝑗𝜔 𝑠
So,
𝑉 𝑗𝜔 𝑅
𝑉 𝑗𝜔 𝑅
[MECH662-matlab]
3
[Introduction to matlab programming]

Which is,
𝑉 𝑠 𝑅 𝑠𝐶
𝑉 𝑠 .𝑅 𝑠𝐶

𝑠𝑅𝐶
1 𝑠𝑅𝐶

Where,
𝑅𝐶is the time constant 𝑇
So, the transfer function of the HPF is:

𝑉 𝑠 𝑇𝑠
𝑉 𝑠 1 𝑇𝑠

1- Open MATLAB software


2- Open Simulink as shown below

3- Now, open a “New model”

4- Save as “LAB2”
5- Go to “Simulink” >>“Sources” and add “Sine Wave”

Course Module
6- Go to “Simulink” >>“Sinks” and add “Scope”

7- Connect them as shown below


8- Double click on “Sine Wave” and double check the parameters as shown below

9- Repeat steps 5 to 8 for the following frequencies:


‐ 𝜔 125680 𝑟𝑎𝑑/𝑠𝑒𝑐
‐ 𝜔 2953480 𝑟𝑎𝑑/𝑠𝑒𝑐
‐ 𝜔 18852000 𝑟𝑎𝑑/𝑠𝑒𝑐

10- Go to “Simulink”>> “Math Operations” and add “Sum” TWICE!


[MECH662-matlab]
5
[Introduction to matlab programming]

11- Connect them as shown below

Type equation here.

12- Go to “DSP SystemBlockset” >>“DSP System Sinks” and add “Spectrum Scope”TWICE!

13- Double click on “Spectrum Scope” and double check the following parameters

Course Module
14- Go to “Simulink” >> “Discrete” and add “Zero-Order Hold”TWICE!
15- Double click on “Zero-Oder Hold” and check the parameter as shown below

16- Go to “Simulink” >> “Continuous” and add “Transfer Fcn”


[MECH662-matlab]
7
[Introduction to matlab programming]

17- Connect the design as shown below, make sure the Simulation End Time = 5e-3 and rename
“Spectrum Scope” and “Transfer Fcn” as shown below.

18- Copy “Low_Pass_Filter”, “Zero-Order Hold” and “After_LPF” then paste them TWICE!
19- Connect them as shown below

Course Module
20- Make sure you save your design and keep it safe for future work.
21- Double click on Low_Pass_Filter and edit the time constant (T) as shown below

22- Repeat step 21 for HPF where 𝑇 80𝑛𝑠


23- Repeat step 21 for BPF where 𝑇 430𝑛𝑠 and 𝑇 280𝑛𝑠respectively
24- Add “Scope”s to see the output of the filter in Time-Domain as well as shown below

25- You may rename all blocks for your convenience


26- Save your design and run the simulations
27- Make sure you make your own observations from the results.

<Exercises >
1) Construct a signals with varied values of transfer functions.

References and Supplementary Materials


Books and references
1. Wireless Communication Networks and Systems, Global Edition Stallings – 2018
[MECH662-matlab]
9
[Introduction to matlab programming]

Online Supplementary Reading Materials


● 1. Gordon L. Stüber ‘Principles of Mobile Communication’ springer publications 2016
● MainakChowdhury, ArumitaBiswas ‘Wireless Communication: Theory and Applications’Oxford
university press-2017
● UpenaDalal ‘Wireless communication and networks’ oxford university press-2015
Wireless Multimedia: A Guide to the IEEE 802.15.3 Standard

Course Module

You might also like