SlideShare a Scribd company logo
1
Lab 06:
Filtering a Non-stationary Signal
Submitted By :
Syed Abuzar Hussain Shah
SP15-BEE-096
Uzair Ahmed
SP15-BEE-106
Syed Hasnain Shah
SP15-BEE-100
Submitted To: Sir Usman
Class: BEE-5A
Dated: 27/04/2017
2
Objective:
In today’s lab the objective will be to understand the effect of pole and zeros on
frequency response using MATLAB.
Statement of Problem:
1. Generate a unit step function as you have done in Lab II.
2. Generate the following signal keeping simulation frequency as 1000 and
index as -2000:3000. Where t=index/fs.
3. 𝑥(𝑡)= sin(2𝜋(10)𝑡)𝑢(−𝑡)+ 5cos(2𝜋(65)𝑡)𝑢(𝑡)+ 2sin(2𝜋(200)𝑡)( 𝑢(𝑡 + 1)−
𝑢(𝑡-2)).
4. Plot the signal and its Fourier Transform.
5. Now design a filter using fdatool that provides you only the 10 Hz signal.
6. Now using the following code apply filter to the generated signal.
Hd = f1_lab6;
y=filter(Hd,x);
7. Now repeat step 6 to 8 to attain 65 Hz signal and 200 Hz signal,
respectively.
Procedure:
clc
clear all
close all
index= -2000:3000;
fs=1000;
N=5000;
t=index/fs;
u=sin(2*pi*10*t).*heaviside(-t);
v=5*cos(2*pi*65*t).*heaviside(t);
w=2*sin(2*pi*200*t).*(heaviside(t+1)-heaviside(t-2));
x=u+v+w;
subplot(121)
plot(t,x);
title('input signal')
xlabel('t (sec)')
ylabel('x(t)')
grid on;
3
y=fftshift(fft(x));
T=linspace(-fs/2,fs/2,N);
subplot(122)
plot([T 0],y);
title('FFT')
xlabel('Omega (rad/sec)')
ylabel('|X(j Omega)|')
grid;
10Hz Signal:
clc
clear all
close all
index= -2000:3000;
fs=1000;
N=5000;
t=index/fs;
u=sin(2*pi*10*t).*heaviside(-t);
v=5*cos(2*pi*65*t).*heaviside(t);
w=2*sin(2*pi*200*t).*(heaviside(t+1)-heaviside(t-2));
x=u+v+w;
4
subplot(231)
plot(t,u);
title('sin(2 pi10t).u(-t)')
xlabel('t (sec)')
ylabel('x(t)')
grid on;
subplot(232)
plot(t,v);
title('5cos(2 pi65t).u(t)')
xlabel('t (sec)')
ylabel('x(t)')
grid on;
subplot(233)
plot(t,w);
title('2sin(2 pi200t).(u(t+1)-u(t-2))')
xlabel('t (sec)')
ylabel('x(t)')
grid on;
subplot(234)
plot(t,x);
title('input signal')
xlabel('t (sec)')
ylabel('x(t)')
grid on;
y=fftshift(fft(x));
T=linspace(-fs/2,fs/2,N);
subplot(235)
plot([T 0],y);
title('FFT')
xlabel('Omega (rad/sec)')
ylabel('|X(j Omega)|')
grid;
Filter designing:
For f=10 Hz
Fs=1000Hz
Fpass=11
Fstop=12
5
Hd=twohunhz;
k=filter(Hd,x);
subplot(236)
plot(t,k);
title('10Hz filtered signal')
grid on;
6
65Hz Signal:
clc
clear all
close all
index= -2000:3000;
fs=1000;
N=5000;
t=index/fs;
u=sin(2*pi*10*t).*heaviside(-t);
v=5*cos(2*pi*65*t).*heaviside(t);
w=2*sin(2*pi*200*t).*(heaviside(t+1)-heaviside(t-2));
x=u+v+w;
subplot(231)
plot(t,u);
title('sin(2 pi10t).u(-t)')
xlabel('t (sec)')
ylabel('x(t)')
grid on;
subplot(232)
plot(t,v);
title('5cos(2 pi65t).u(t)')
xlabel('t (sec)')
ylabel('x(t)')
grid on;
subplot(233)
plot(t,w);
title('2sin(2 pi200t).(u(t+1)-u(t-2))')
xlabel('t (sec)')
ylabel('x(t)')
grid on;
subplot(234)
plot(t,x);
title('input signal')
xlabel('t (sec)')
7
ylabel('x(t)')
grid on;
y=fftshift(fft(x));
T=linspace(-fs/2,fs/2,N);
subplot(235)
plot([T 0],y);
title('FFT')
xlabel('Omega (rad/sec)')
ylabel('|X(j Omega)|')
grid;
Filter For f=65 Hz
Fs=1000Hz
Fstop1=60
Fpass1=63
Fpass2=67
Fpass3=70
Hd=sixfivhz;
k=filter(Hd,x);
subplot(236)
plot(t,k);
label('65Hz filtered signal')
grid on;
8
200Hz Signal:
clc
clear all
close all
index= -2000:3000;
fs=1000;
N=5000;
t=index/fs;
u=sin(2*pi*10*t).*heaviside(-t);
v=5*cos(2*pi*65*t).*heaviside(t);
w=2*sin(2*pi*200*t).*(heaviside(t+1)-heaviside(t-2));
x=u+v+w;
subplot(231)
plot(t,u);
title('sin(2 pi10t).u(-t)')
xlabel('t (sec)')
9
ylabel('x(t)')
grid on;
subplot(232)
plot(t,v);
title('5cos(2 pi65t).u(t)')
xlabel('t (sec)')
ylabel('x(t)')
grid on;
subplot(233)
plot(t,w);
title('2sin(2 pi200t).(u(t+1)-u(t-2))')
xlabel('t (sec)')
ylabel('x(t)')
grid on;
subplot(234)
plot(t,x);
title('input signal')
xlabel('t (sec)')
ylabel('x(t)')
grid on;
y=fftshift(fft(x));
T=linspace(-fs/2,fs/2,N);
subplot(235)
plot([T 0],y);
title('FFT')
xlabel('Omega (rad/sec)')
ylabel('|X(j Omega)|')
grid;
Filter For f=200 Hz
Fs=1000Hz
Fstop=195
Fpass=200
10
Hd=twohunhz;
k=filter(Hd,x);
subplot(236)
plot(t,k);
title('200Hz filtered signal')
grid on;
11
Questions:
Q1: While designing your filter which filter did you choose FIR or IIR?
Ans: We designed our filter using IIR.
Q2: What was the effect of using an FIR filter?
Ans: Using FIR, it gives us linear phase and constant group delay but the order
of the system is high so speed of processing is slow and it is time consuming.
Q3: What was the effect of using an IIR Filter?
Ans: Using IIR, order of the system is low and processing of the system is fast
but it doesn’t give us constant group delay and linear phase.
Q4: Explain in which case you used Low-pass, high-pass or bandpass and
also describe the pole zero placement for each case.
Ans: In the 1st
case for filtering data we use low pass filter with cutoff at 10Hz.
In 2nd
case we use bandpass filter with cutoff at 65Hz and in 3rd
case we use
highpass filter with cutoff at 200Hz.
Conclusion:
In this lab we analyse the bahaviour of the time varying signal after passing
through filters of certain cutoff value. We learn to extract our desired
information form the signal using lowpass, bandpass and highpass filters.
Also we learn to design filter according to our required situation.
We use FIR filter where we compromise on cost and speed and IIR filters where
we compromise on phase.

More Related Content

PPTX
Part 3 v2
PPTX
Design of digital filters
PPTX
ANALYTIC SIGNAL GENERATION- DIGITAL SIGNAL PROCESSORS AND ARCHITECTURE ...
PPT
PDF
IRJET- Filter Design for Educational Set Via Labview Software Program
PDF
Simulink based design simulations of band pass fir filter
Part 3 v2
Design of digital filters
ANALYTIC SIGNAL GENERATION- DIGITAL SIGNAL PROCESSORS AND ARCHITECTURE ...
IRJET- Filter Design for Educational Set Via Labview Software Program
Simulink based design simulations of band pass fir filter

Similar to filtering of non stationary signal (20)

PDF
Simulink based design simulations of band pass fir filter
PDF
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
PDF
Simulation Study of FIR Filter based on MATLAB
PPTX
Dss
PDF
Time domain analysis and synthesis using Pth norm filter design
PDF
Chapter 5(1).pdf
PPTX
Signal Processing Assignment Help
PDF
Fundamentals of Digital Signal Processing - Question Bank
PDF
DSP_FOEHU - Lec 10 - FIR Filter Design
PDF
Digital Signal Processing Tutorial: Chapt 4 design of digital filters (FIR)
PPT
Low pass filter
PDF
IRJET- Designing of Basic Types of Filters using Standard Tool
PDF
DSP - Realization of Finite Impulse Response Filter
PDF
Digital Signal Processing-Digital Filters
PDF
EC8553 Discrete time signal processing
PDF
N010237982
PPTX
FIR Filters Lecture (What are FIR FIlters)pptx
PPTX
Signal Processing Assignment Help
PPTX
filter design
PDF
Dsp Concept Maping
Simulink based design simulations of band pass fir filter
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
Simulation Study of FIR Filter based on MATLAB
Dss
Time domain analysis and synthesis using Pth norm filter design
Chapter 5(1).pdf
Signal Processing Assignment Help
Fundamentals of Digital Signal Processing - Question Bank
DSP_FOEHU - Lec 10 - FIR Filter Design
Digital Signal Processing Tutorial: Chapt 4 design of digital filters (FIR)
Low pass filter
IRJET- Designing of Basic Types of Filters using Standard Tool
DSP - Realization of Finite Impulse Response Filter
Digital Signal Processing-Digital Filters
EC8553 Discrete time signal processing
N010237982
FIR Filters Lecture (What are FIR FIlters)pptx
Signal Processing Assignment Help
filter design
Dsp Concept Maping
Ad

More from COMSATS Abbottabad (20)

PDF
Kalman filter
PDF
Enterpreneurship
PPTX
Sine wave inverter
PPTX
Light Tracking Solar Panel
PDF
Analysis of Electro-Mechanical System
PDF
coding and burning program in FPGA
PDF
8 bit full adder
PDF
Fabrication process of Integrated Circuit (IC's)
DOCX
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
PDF
implementation of data instrucions in emu8086
PDF
Addition, subtraction and multiplication in assembly language
PDF
Mathematical Modelling of Electro-Mechanical System in Matlab
PDF
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
PDF
Introduction to MATLAB
PDF
Encoder + decoder
PDF
Principles of Communication
PDF
Aurduino coding for transformer interfacing
PDF
Transformer Interfacing with Laptop
PDF
Temperature control Switch and Display By Led
PPTX
stress and strain
Kalman filter
Enterpreneurship
Sine wave inverter
Light Tracking Solar Panel
Analysis of Electro-Mechanical System
coding and burning program in FPGA
8 bit full adder
Fabrication process of Integrated Circuit (IC's)
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
implementation of data instrucions in emu8086
Addition, subtraction and multiplication in assembly language
Mathematical Modelling of Electro-Mechanical System in Matlab
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Introduction to MATLAB
Encoder + decoder
Principles of Communication
Aurduino coding for transformer interfacing
Transformer Interfacing with Laptop
Temperature control Switch and Display By Led
stress and strain
Ad

Recently uploaded (20)

PPTX
Artificial Intelligence
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Sustainable Sites - Green Building Construction
PDF
Well-logging-methods_new................
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
web development for engineering and engineering
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPT
Project quality management in manufacturing
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
737-MAX_SRG.pdf student reference guides
PPTX
Current and future trends in Computer Vision.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
Artificial Intelligence
Foundation to blockchain - A guide to Blockchain Tech
Sustainable Sites - Green Building Construction
Well-logging-methods_new................
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
CH1 Production IntroductoryConcepts.pptx
web development for engineering and engineering
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
Project quality management in manufacturing
CYBER-CRIMES AND SECURITY A guide to understanding
bas. eng. economics group 4 presentation 1.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
737-MAX_SRG.pdf student reference guides
Current and future trends in Computer Vision.pptx
Internet of Things (IOT) - A guide to understanding
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
OOP with Java - Java Introduction (Basics)
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Operating System & Kernel Study Guide-1 - converted.pdf

filtering of non stationary signal

  • 1. 1 Lab 06: Filtering a Non-stationary Signal Submitted By : Syed Abuzar Hussain Shah SP15-BEE-096 Uzair Ahmed SP15-BEE-106 Syed Hasnain Shah SP15-BEE-100 Submitted To: Sir Usman Class: BEE-5A Dated: 27/04/2017
  • 2. 2 Objective: In today’s lab the objective will be to understand the effect of pole and zeros on frequency response using MATLAB. Statement of Problem: 1. Generate a unit step function as you have done in Lab II. 2. Generate the following signal keeping simulation frequency as 1000 and index as -2000:3000. Where t=index/fs. 3. 𝑥(𝑡)= sin(2𝜋(10)𝑡)𝑢(−𝑡)+ 5cos(2𝜋(65)𝑡)𝑢(𝑡)+ 2sin(2𝜋(200)𝑡)( 𝑢(𝑡 + 1)− 𝑢(𝑡-2)). 4. Plot the signal and its Fourier Transform. 5. Now design a filter using fdatool that provides you only the 10 Hz signal. 6. Now using the following code apply filter to the generated signal. Hd = f1_lab6; y=filter(Hd,x); 7. Now repeat step 6 to 8 to attain 65 Hz signal and 200 Hz signal, respectively. Procedure: clc clear all close all index= -2000:3000; fs=1000; N=5000; t=index/fs; u=sin(2*pi*10*t).*heaviside(-t); v=5*cos(2*pi*65*t).*heaviside(t); w=2*sin(2*pi*200*t).*(heaviside(t+1)-heaviside(t-2)); x=u+v+w; subplot(121) plot(t,x); title('input signal') xlabel('t (sec)') ylabel('x(t)') grid on;
  • 3. 3 y=fftshift(fft(x)); T=linspace(-fs/2,fs/2,N); subplot(122) plot([T 0],y); title('FFT') xlabel('Omega (rad/sec)') ylabel('|X(j Omega)|') grid; 10Hz Signal: clc clear all close all index= -2000:3000; fs=1000; N=5000; t=index/fs; u=sin(2*pi*10*t).*heaviside(-t); v=5*cos(2*pi*65*t).*heaviside(t); w=2*sin(2*pi*200*t).*(heaviside(t+1)-heaviside(t-2)); x=u+v+w;
  • 4. 4 subplot(231) plot(t,u); title('sin(2 pi10t).u(-t)') xlabel('t (sec)') ylabel('x(t)') grid on; subplot(232) plot(t,v); title('5cos(2 pi65t).u(t)') xlabel('t (sec)') ylabel('x(t)') grid on; subplot(233) plot(t,w); title('2sin(2 pi200t).(u(t+1)-u(t-2))') xlabel('t (sec)') ylabel('x(t)') grid on; subplot(234) plot(t,x); title('input signal') xlabel('t (sec)') ylabel('x(t)') grid on; y=fftshift(fft(x)); T=linspace(-fs/2,fs/2,N); subplot(235) plot([T 0],y); title('FFT') xlabel('Omega (rad/sec)') ylabel('|X(j Omega)|') grid; Filter designing: For f=10 Hz Fs=1000Hz Fpass=11 Fstop=12
  • 6. 6 65Hz Signal: clc clear all close all index= -2000:3000; fs=1000; N=5000; t=index/fs; u=sin(2*pi*10*t).*heaviside(-t); v=5*cos(2*pi*65*t).*heaviside(t); w=2*sin(2*pi*200*t).*(heaviside(t+1)-heaviside(t-2)); x=u+v+w; subplot(231) plot(t,u); title('sin(2 pi10t).u(-t)') xlabel('t (sec)') ylabel('x(t)') grid on; subplot(232) plot(t,v); title('5cos(2 pi65t).u(t)') xlabel('t (sec)') ylabel('x(t)') grid on; subplot(233) plot(t,w); title('2sin(2 pi200t).(u(t+1)-u(t-2))') xlabel('t (sec)') ylabel('x(t)') grid on; subplot(234) plot(t,x); title('input signal') xlabel('t (sec)')
  • 7. 7 ylabel('x(t)') grid on; y=fftshift(fft(x)); T=linspace(-fs/2,fs/2,N); subplot(235) plot([T 0],y); title('FFT') xlabel('Omega (rad/sec)') ylabel('|X(j Omega)|') grid; Filter For f=65 Hz Fs=1000Hz Fstop1=60 Fpass1=63 Fpass2=67 Fpass3=70 Hd=sixfivhz; k=filter(Hd,x); subplot(236) plot(t,k); label('65Hz filtered signal') grid on;
  • 8. 8 200Hz Signal: clc clear all close all index= -2000:3000; fs=1000; N=5000; t=index/fs; u=sin(2*pi*10*t).*heaviside(-t); v=5*cos(2*pi*65*t).*heaviside(t); w=2*sin(2*pi*200*t).*(heaviside(t+1)-heaviside(t-2)); x=u+v+w; subplot(231) plot(t,u); title('sin(2 pi10t).u(-t)') xlabel('t (sec)')
  • 9. 9 ylabel('x(t)') grid on; subplot(232) plot(t,v); title('5cos(2 pi65t).u(t)') xlabel('t (sec)') ylabel('x(t)') grid on; subplot(233) plot(t,w); title('2sin(2 pi200t).(u(t+1)-u(t-2))') xlabel('t (sec)') ylabel('x(t)') grid on; subplot(234) plot(t,x); title('input signal') xlabel('t (sec)') ylabel('x(t)') grid on; y=fftshift(fft(x)); T=linspace(-fs/2,fs/2,N); subplot(235) plot([T 0],y); title('FFT') xlabel('Omega (rad/sec)') ylabel('|X(j Omega)|') grid; Filter For f=200 Hz Fs=1000Hz Fstop=195 Fpass=200
  • 11. 11 Questions: Q1: While designing your filter which filter did you choose FIR or IIR? Ans: We designed our filter using IIR. Q2: What was the effect of using an FIR filter? Ans: Using FIR, it gives us linear phase and constant group delay but the order of the system is high so speed of processing is slow and it is time consuming. Q3: What was the effect of using an IIR Filter? Ans: Using IIR, order of the system is low and processing of the system is fast but it doesn’t give us constant group delay and linear phase. Q4: Explain in which case you used Low-pass, high-pass or bandpass and also describe the pole zero placement for each case. Ans: In the 1st case for filtering data we use low pass filter with cutoff at 10Hz. In 2nd case we use bandpass filter with cutoff at 65Hz and in 3rd case we use highpass filter with cutoff at 200Hz. Conclusion: In this lab we analyse the bahaviour of the time varying signal after passing through filters of certain cutoff value. We learn to extract our desired information form the signal using lowpass, bandpass and highpass filters. Also we learn to design filter according to our required situation. We use FIR filter where we compromise on cost and speed and IIR filters where we compromise on phase.