SlideShare a Scribd company logo
1 of 11
Download to read offline
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

Similar to filtering of non stationary signal

dsp-1.pdf
dsp-1.pdfdsp-1.pdf
The Doppler EffectWhat is the Doppler effect, and why is it impo.docx
The Doppler EffectWhat is the Doppler effect, and why is it impo.docxThe Doppler EffectWhat is the Doppler effect, and why is it impo.docx
The Doppler EffectWhat is the Doppler effect, and why is it impo.docx
cherry686017
 

Similar to filtering of non stationary signal (20)

ECET 350 Entire Course NEW
ECET 350 Entire Course NEWECET 350 Entire Course NEW
ECET 350 Entire Course NEW
 
Digital Filters Part 1
Digital Filters Part 1Digital Filters Part 1
Digital Filters Part 1
 
Discrete time signal processing unit-2
Discrete time signal processing unit-2Discrete time signal processing unit-2
Discrete time signal processing unit-2
 
ECG Signal Denoising using Digital Filter and Adaptive Filter
ECG Signal Denoising using Digital Filter and Adaptive FilterECG Signal Denoising using Digital Filter and Adaptive Filter
ECG Signal Denoising using Digital Filter and Adaptive Filter
 
Op amp applications filters cw final (2)
Op amp applications filters cw final (2)Op amp applications filters cw final (2)
Op amp applications filters cw final (2)
 
4 Band Audio Equalizer Project
4 Band Audio Equalizer Project4 Band Audio Equalizer Project
4 Band Audio Equalizer Project
 
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter DesignDSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
 
Intro-Peakvue.pdf
Intro-Peakvue.pdfIntro-Peakvue.pdf
Intro-Peakvue.pdf
 
FFT
FFTFFT
FFT
 
DSP_FOEHU - Lec 10 - FIR Filter Design
DSP_FOEHU - Lec 10 - FIR Filter DesignDSP_FOEHU - Lec 10 - FIR Filter Design
DSP_FOEHU - Lec 10 - FIR Filter Design
 
IRJET- Design and Implementation of Butterworth, Chebyshev-I Filters for Digi...
IRJET- Design and Implementation of Butterworth, Chebyshev-I Filters for Digi...IRJET- Design and Implementation of Butterworth, Chebyshev-I Filters for Digi...
IRJET- Design and Implementation of Butterworth, Chebyshev-I Filters for Digi...
 
Elegant Solutions
Elegant SolutionsElegant Solutions
Elegant Solutions
 
Netw 360 week 2 i lab rf behavior calculations
Netw 360 week 2 i lab rf behavior calculationsNetw 360 week 2 i lab rf behavior calculations
Netw 360 week 2 i lab rf behavior calculations
 
Netw 360 week 2 i lab rf behavior calculations
Netw 360 week 2 i lab rf behavior calculationsNetw 360 week 2 i lab rf behavior calculations
Netw 360 week 2 i lab rf behavior calculations
 
Netw 360 week 2 i lab rf behavior calculations
Netw 360 week 2 i lab rf behavior calculationsNetw 360 week 2 i lab rf behavior calculations
Netw 360 week 2 i lab rf behavior calculations
 
Netw 360 week 2 i lab rf behavior calculations
Netw 360 week 2 i lab rf behavior calculationsNetw 360 week 2 i lab rf behavior calculations
Netw 360 week 2 i lab rf behavior calculations
 
Design Low Pass FIR Digital Filter for Cut off Frequency Calculation Using Ar...
Design Low Pass FIR Digital Filter for Cut off Frequency Calculation Using Ar...Design Low Pass FIR Digital Filter for Cut off Frequency Calculation Using Ar...
Design Low Pass FIR Digital Filter for Cut off Frequency Calculation Using Ar...
 
dsp-1.pdf
dsp-1.pdfdsp-1.pdf
dsp-1.pdf
 
The Doppler EffectWhat is the Doppler effect, and why is it impo.docx
The Doppler EffectWhat is the Doppler effect, and why is it impo.docxThe Doppler EffectWhat is the Doppler effect, and why is it impo.docx
The Doppler EffectWhat is the Doppler effect, and why is it impo.docx
 
A 128 tap highly tunable cmos if finite impulse response filter for pulsed ra...
A 128 tap highly tunable cmos if finite impulse response filter for pulsed ra...A 128 tap highly tunable cmos if finite impulse response filter for pulsed ra...
A 128 tap highly tunable cmos if finite impulse response filter for pulsed ra...
 

More from COMSATS Abbottabad

More from COMSATS Abbottabad (20)

Kalman filter
Kalman filterKalman filter
Kalman filter
 
Enterpreneurship
EnterpreneurshipEnterpreneurship
Enterpreneurship
 
Sine wave inverter
Sine wave inverterSine wave inverter
Sine wave inverter
 
Light Tracking Solar Panel
Light Tracking Solar PanelLight Tracking Solar Panel
Light Tracking Solar Panel
 
Analysis of Electro-Mechanical System
Analysis of Electro-Mechanical SystemAnalysis of Electro-Mechanical System
Analysis of Electro-Mechanical System
 
coding and burning program in FPGA
coding and burning program in FPGAcoding and burning program in FPGA
coding and burning program in FPGA
 
8 bit full adder
8 bit full adder8 bit full adder
8 bit full adder
 
Fabrication process of Integrated Circuit (IC's)
Fabrication process of Integrated Circuit (IC's)Fabrication process of Integrated Circuit (IC's)
Fabrication process of Integrated Circuit (IC's)
 
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
 
implementation of data instrucions in emu8086
implementation of data instrucions in emu8086implementation of data instrucions in emu8086
implementation of data instrucions in emu8086
 
Addition, subtraction and multiplication in assembly language
Addition, subtraction and multiplication in assembly languageAddition, subtraction and multiplication in assembly language
Addition, subtraction and multiplication in assembly language
 
Mathematical Modelling of Electro-Mechanical System in Matlab
Mathematical Modelling of Electro-Mechanical System in MatlabMathematical Modelling of Electro-Mechanical System in Matlab
Mathematical Modelling of Electro-Mechanical System in Matlab
 
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLABMathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
 
Introduction to MATLAB
Introduction to MATLAB Introduction to MATLAB
Introduction to MATLAB
 
Encoder + decoder
Encoder + decoderEncoder + decoder
Encoder + decoder
 
Principles of Communication
Principles of CommunicationPrinciples of Communication
Principles of Communication
 
Aurduino coding for transformer interfacing
Aurduino coding for transformer interfacingAurduino coding for transformer interfacing
Aurduino coding for transformer interfacing
 
Transformer Interfacing with Laptop
Transformer Interfacing with LaptopTransformer Interfacing with Laptop
Transformer Interfacing with Laptop
 
Temperature control Switch and Display By Led
Temperature control Switch and Display By LedTemperature control Switch and Display By Led
Temperature control Switch and Display By Led
 
stress and strain
stress and strainstress and strain
stress and strain
 

Recently uploaded

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 

Recently uploaded (20)

(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 

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.