SlideShare a Scribd company logo
1 of 6
Download to read offline
ECE324: DIGITAL SIGNAL PROCESSING LABORATORY
Practical No.: 6
Roll No.:B-54 Registration No.: 11205816 Name: Shyamveer Singh
Aim: Design a FIR filter
1. Low pass filter
Mathematical Expressions Required:
Wc = 2π(fc / fs)
Hd(w) =
Inputs :
wc=pi/2
m=7
Program Code:
function[]=lpfshyam(wc,N)
i=(N-1)/2;
wn=wc/pi;
syms w
for n=-i:i
y(n+i+1)=(int(exp(w*n*j),-wc,wc))*1/(2*pi);
end
y=sym2poly(y)
for n=0:N-1
w(n+1)=0.54-0.46*cos(2*pi*n/(N-1));
h(n+1)=y(n+1).*w(n+1);
end
h=sym2poly(h)
fir1(N-1,wn)
end
Aim: Design a FIR filter
1. Low pass filter
Output:
>> lpfshyam((pi/2),7)
y =
-0.1061 0 0.3183 0.5000 0.3183 0 -0.1061
h =
-0.0085 0 0.2451 0.5000 0.2451 0 -0.0085
ans =
-0.0087 0.0000 0.2518 0.5138 0.2518 0.0000 -0.0087
Analysis/ Learning outcomes
This experiment give me a better understanding of low pass filter and
helps me to understand its working graphically.
Aim: Design a FIR filter
2. High pass filter
Mathematical Expressions Required:
Wc = 2π(fc / fs)
Hd(w) =
Inputs:
Wc=pi/2
m=7
Program Codes:
function[]=hpfshyam(wc,N)
i=(N-1)/2;
wn=wc/pi;
syms w
for n=-i:i
y(n+i+1)=(1/2*pi)*(int(exp(j*w*n),-pi,-wc)+int(exp(j*w*n),wc,pi));
end
y=sym2poly(y)
for n=0:N-1
w(n+1)=0.54-0.46*cos(2*pi*n/(N-1));
h(n+1)=y(n+1).*w(n+1);
end
h=sym2poly(h)
fir1(N-1,wn)
end
Output:
>> hpfshyam((pi/2),7)
y =
1.0472 0 -3.1416 4.9348 -3.1416 0 1.0472
h =
0.0838 0 -2.4190 4.9348 -2.4190 0 0.0838
ans =
-0.0087 0.0000 0.2518 0.5138 0.2518 0.0000 -0.0087
Aim: Design a FIR filter
3. Band pass filter
Mathematical Expressions Required:
Wc = 2π(fc / fs)
Hd(w) =
Inputs:
Wc1=pi/4 ,wc2=pi/6
m=7
Program Codes:
function[]=bpfshyam(wc1,wc2,N)
i=(N-1)/2;
wn1=wc1/pi;
wn2=wc2/pi;
syms w
for n=-i:i
y(n+i+1)=(1/2*pi)*(int(exp(j*w*n),-wc2,-wc1)+int(exp(j*w*n),wc1,wc2));
end
y=sym2poly(y)
for n=0:N-1
w(n+1)=0.54-0.46*cos(2*pi*n/(N-1));
h(n+1)=y(n+1).*w(n+1);
end
h=sym2poly(h)
fir1(N-1,wn1)
end
Analysis/ Learning outcomes
This experiment give me a better understanding of High pass filter and
helps me to understand its working graphically
Outputs/ Graphs/ Plots:
>> bpfshyam((pi/4),(pi/6),7)
y =
0.3067 -0.2104 -0.6506 -0.8225 -0.6506 -0.2104 0.3067
h =
0.0245 -0.0652 -0.5010 -0.8225 -0.5010 -0.0652 0.0245
Aim: Design a FIR filter
4. Band stop filter
Mathematical Expressions Required:
Wc = 2π(fc / fs)
Hd(w) =
Inputs:
Wc1=pi/4 , wc2=pi/6
m=7
Analysis/ Learning outcomes
This experiment give me a better understanding of band pass filter and
helps me to understand its working graphically
Program Codes:
function[]=bsfshyam(wc1,wc2,N)
i=(N-1)/2;
wn1=wc1/pi;
wn2=wc2/pi;
syms w
for n=-i:i
y(n+i+1)=(1/2*pi)*(int(exp(j*w*n),-pi,-wc2)+int(exp(j*w*n),-
wc1,wc1)+int(exp(j*w*n),wc2,pi));
end
y=sym2poly(y)
for n=0:N-1
w(n+1)=0.54-0.46*cos(2*pi*n/(N-1));
h(n+1)=y(n+1).*w(n+1);
end
h=sym2poly(h)
fir1(N-1,wn1)
end
Outputs/ Graphs/ Plots:
>> bsfshyam(pi/4,pi/6,7)
y =
-0.3067 0.2104 0.6506 10.6921 0.6506 0.2104 -0.3067
h =
-0.0245 0.0652 0.5010 10.6921 0.5010 0.0652 -0.0245
Analysis/ Learning outcomes
This experiment give me a better understanding of band stop filter and
helps me to understand its working graphically

More Related Content

What's hot (20)

Asic design flow
Asic design flowAsic design flow
Asic design flow
 
Unit ii.arc of tms320 c5 xx
Unit ii.arc of tms320 c5 xxUnit ii.arc of tms320 c5 xx
Unit ii.arc of tms320 c5 xx
 
Dif fft
Dif fftDif fft
Dif fft
 
Logic synthesis,flootplan&placement
Logic synthesis,flootplan&placementLogic synthesis,flootplan&placement
Logic synthesis,flootplan&placement
 
Fpga
FpgaFpga
Fpga
 
Introduction to FPGAs
Introduction to FPGAsIntroduction to FPGAs
Introduction to FPGAs
 
02 addressing modes 6800
02 addressing modes 680002 addressing modes 6800
02 addressing modes 6800
 
VLSI & E-CAD Lab Manual
VLSI & E-CAD Lab ManualVLSI & E-CAD Lab Manual
VLSI & E-CAD Lab Manual
 
VLIW Processors
VLIW ProcessorsVLIW Processors
VLIW Processors
 
microcontroller vs microprocessor
microcontroller vs microprocessormicrocontroller vs microprocessor
microcontroller vs microprocessor
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Gate Diffusion Input Technology (Very Large Scale Integration)
Gate Diffusion Input Technology (Very Large Scale Integration)Gate Diffusion Input Technology (Very Large Scale Integration)
Gate Diffusion Input Technology (Very Large Scale Integration)
 
EPROM, PROM & ROM
EPROM, PROM & ROMEPROM, PROM & ROM
EPROM, PROM & ROM
 
Microprocessor vs. microcontroller
Microprocessor vs. microcontrollerMicroprocessor vs. microcontroller
Microprocessor vs. microcontroller
 
Sequential Logic Circuits
Sequential Logic CircuitsSequential Logic Circuits
Sequential Logic Circuits
 
Cmos testing
Cmos testingCmos testing
Cmos testing
 
4 bit uni shift reg
4 bit uni shift reg4 bit uni shift reg
4 bit uni shift reg
 
Esp32 cam arduino-123
Esp32 cam arduino-123Esp32 cam arduino-123
Esp32 cam arduino-123
 
Signal descriptors of 8086
Signal descriptors of 8086Signal descriptors of 8086
Signal descriptors of 8086
 

Viewers also liked

B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentationManchireddy Reddy
 
Basics of Digital Filters
Basics of Digital FiltersBasics of Digital Filters
Basics of Digital Filtersop205
 
Fir filter concepts
Fir filter conceptsFir filter concepts
Fir filter concepts11mr11mahesh
 
Design of FIR filters
Design of FIR filtersDesign of FIR filters
Design of FIR filtersop205
 

Viewers also liked (6)

9 Filtrasyon I
9 Filtrasyon I9 Filtrasyon I
9 Filtrasyon I
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 
Basics of Digital Filters
Basics of Digital FiltersBasics of Digital Filters
Basics of Digital Filters
 
Filters
FiltersFilters
Filters
 
Fir filter concepts
Fir filter conceptsFir filter concepts
Fir filter concepts
 
Design of FIR filters
Design of FIR filtersDesign of FIR filters
Design of FIR filters
 

Similar to MATLAB CODE OF FIR Filter Designing LPF HPF BPF BSF

Matlab fair-record-model
Matlab fair-record-modelMatlab fair-record-model
Matlab fair-record-modelajaydev1111
 
A Simulation Training for Sigma-Delta Modulators by Matlab CAD-Tool
A Simulation Training for Sigma-Delta Modulators by Matlab CAD-ToolA Simulation Training for Sigma-Delta Modulators by Matlab CAD-Tool
A Simulation Training for Sigma-Delta Modulators by Matlab CAD-ToolMCI
 
Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)thanh nguyen
 
Forward & Backward Differenece Table
Forward & Backward Differenece TableForward & Backward Differenece Table
Forward & Backward Differenece TableSaloni Singhal
 

Similar to MATLAB CODE OF FIR Filter Designing LPF HPF BPF BSF (6)

DFT and IDFT Matlab Code
DFT and IDFT Matlab CodeDFT and IDFT Matlab Code
DFT and IDFT Matlab Code
 
Matlab fair-record-model
Matlab fair-record-modelMatlab fair-record-model
Matlab fair-record-model
 
A Simulation Training for Sigma-Delta Modulators by Matlab CAD-Tool
A Simulation Training for Sigma-Delta Modulators by Matlab CAD-ToolA Simulation Training for Sigma-Delta Modulators by Matlab CAD-Tool
A Simulation Training for Sigma-Delta Modulators by Matlab CAD-Tool
 
Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)
 
C questions
C questionsC questions
C questions
 
Forward & Backward Differenece Table
Forward & Backward Differenece TableForward & Backward Differenece Table
Forward & Backward Differenece Table
 

More from Bharti Airtel Ltd.

C bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationC bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationBharti Airtel Ltd.
 
Mcq4 ac-operational-amplifiers
Mcq4 ac-operational-amplifiersMcq4 ac-operational-amplifiers
Mcq4 ac-operational-amplifiersBharti Airtel Ltd.
 
C bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationC bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationBharti Airtel Ltd.
 
A bjt-operating-modes-configurations
A bjt-operating-modes-configurationsA bjt-operating-modes-configurations
A bjt-operating-modes-configurationsBharti Airtel Ltd.
 
Noise detection from the signal matlab code, Signal Diagnosis
Noise detection from the signal matlab code, Signal Diagnosis Noise detection from the signal matlab code, Signal Diagnosis
Noise detection from the signal matlab code, Signal Diagnosis Bharti Airtel Ltd.
 
Sequence detector Verilog Code
Sequence detector Verilog CodeSequence detector Verilog Code
Sequence detector Verilog CodeBharti Airtel Ltd.
 
To designing counters using verilog code
To designing counters using verilog codeTo designing counters using verilog code
To designing counters using verilog codeBharti Airtel Ltd.
 
Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Bharti Airtel Ltd.
 

More from Bharti Airtel Ltd. (20)

Resume Shyamveer
Resume ShyamveerResume Shyamveer
Resume Shyamveer
 
BHEL Final Report
BHEL Final ReportBHEL Final Report
BHEL Final Report
 
BHEL PPT
BHEL PPTBHEL PPT
BHEL PPT
 
Amplitude modulated-systmes
Amplitude modulated-systmesAmplitude modulated-systmes
Amplitude modulated-systmes
 
Amplitude modulated-systems
Amplitude modulated-systemsAmplitude modulated-systems
Amplitude modulated-systems
 
Mcq5 ac-fet-amplifiers
Mcq5 ac-fet-amplifiersMcq5 ac-fet-amplifiers
Mcq5 ac-fet-amplifiers
 
Mcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifierMcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifier
 
C bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationC bjt-biasing-and-stabilization
C bjt-biasing-and-stabilization
 
Mcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifierMcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifier
 
Mcq4 ac-operational-amplifiers
Mcq4 ac-operational-amplifiersMcq4 ac-operational-amplifiers
Mcq4 ac-operational-amplifiers
 
Logic gates-notesdc-iii
Logic gates-notesdc-iiiLogic gates-notesdc-iii
Logic gates-notesdc-iii
 
C bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationC bjt-biasing-and-stabilization
C bjt-biasing-and-stabilization
 
B bjt-characteristics
B bjt-characteristicsB bjt-characteristics
B bjt-characteristics
 
A bjt-operating-modes-configurations
A bjt-operating-modes-configurationsA bjt-operating-modes-configurations
A bjt-operating-modes-configurations
 
Resume shyam final
Resume shyam finalResume shyam final
Resume shyam final
 
Noise detection from the signal matlab code, Signal Diagnosis
Noise detection from the signal matlab code, Signal Diagnosis Noise detection from the signal matlab code, Signal Diagnosis
Noise detection from the signal matlab code, Signal Diagnosis
 
Sequence detector Verilog Code
Sequence detector Verilog CodeSequence detector Verilog Code
Sequence detector Verilog Code
 
Divine inspiration
Divine inspirationDivine inspiration
Divine inspiration
 
To designing counters using verilog code
To designing counters using verilog codeTo designing counters using verilog code
To designing counters using verilog code
 
Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer
 

Recently uploaded

『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书rnrncn29
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Romil Mishra
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewsandhya757531
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsapna80328
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfManish Kumar
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptJohnWilliam111370
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSsandhya757531
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxStephen Sitton
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solidnamansinghjarodiya
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfisabel213075
 

Recently uploaded (20)

『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overview
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveying
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptx
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solid
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdf
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 

MATLAB CODE OF FIR Filter Designing LPF HPF BPF BSF

  • 1. ECE324: DIGITAL SIGNAL PROCESSING LABORATORY Practical No.: 6 Roll No.:B-54 Registration No.: 11205816 Name: Shyamveer Singh Aim: Design a FIR filter 1. Low pass filter Mathematical Expressions Required: Wc = 2π(fc / fs) Hd(w) = Inputs : wc=pi/2 m=7 Program Code: function[]=lpfshyam(wc,N) i=(N-1)/2; wn=wc/pi; syms w for n=-i:i y(n+i+1)=(int(exp(w*n*j),-wc,wc))*1/(2*pi); end y=sym2poly(y) for n=0:N-1 w(n+1)=0.54-0.46*cos(2*pi*n/(N-1)); h(n+1)=y(n+1).*w(n+1); end h=sym2poly(h) fir1(N-1,wn) end
  • 2. Aim: Design a FIR filter 1. Low pass filter Output: >> lpfshyam((pi/2),7) y = -0.1061 0 0.3183 0.5000 0.3183 0 -0.1061 h = -0.0085 0 0.2451 0.5000 0.2451 0 -0.0085 ans = -0.0087 0.0000 0.2518 0.5138 0.2518 0.0000 -0.0087 Analysis/ Learning outcomes This experiment give me a better understanding of low pass filter and helps me to understand its working graphically. Aim: Design a FIR filter 2. High pass filter Mathematical Expressions Required: Wc = 2π(fc / fs) Hd(w) =
  • 3. Inputs: Wc=pi/2 m=7 Program Codes: function[]=hpfshyam(wc,N) i=(N-1)/2; wn=wc/pi; syms w for n=-i:i y(n+i+1)=(1/2*pi)*(int(exp(j*w*n),-pi,-wc)+int(exp(j*w*n),wc,pi)); end y=sym2poly(y) for n=0:N-1 w(n+1)=0.54-0.46*cos(2*pi*n/(N-1)); h(n+1)=y(n+1).*w(n+1); end h=sym2poly(h) fir1(N-1,wn) end Output: >> hpfshyam((pi/2),7) y = 1.0472 0 -3.1416 4.9348 -3.1416 0 1.0472 h = 0.0838 0 -2.4190 4.9348 -2.4190 0 0.0838 ans = -0.0087 0.0000 0.2518 0.5138 0.2518 0.0000 -0.0087
  • 4. Aim: Design a FIR filter 3. Band pass filter Mathematical Expressions Required: Wc = 2π(fc / fs) Hd(w) = Inputs: Wc1=pi/4 ,wc2=pi/6 m=7 Program Codes: function[]=bpfshyam(wc1,wc2,N) i=(N-1)/2; wn1=wc1/pi; wn2=wc2/pi; syms w for n=-i:i y(n+i+1)=(1/2*pi)*(int(exp(j*w*n),-wc2,-wc1)+int(exp(j*w*n),wc1,wc2)); end y=sym2poly(y) for n=0:N-1 w(n+1)=0.54-0.46*cos(2*pi*n/(N-1)); h(n+1)=y(n+1).*w(n+1); end h=sym2poly(h) fir1(N-1,wn1) end Analysis/ Learning outcomes This experiment give me a better understanding of High pass filter and helps me to understand its working graphically
  • 5. Outputs/ Graphs/ Plots: >> bpfshyam((pi/4),(pi/6),7) y = 0.3067 -0.2104 -0.6506 -0.8225 -0.6506 -0.2104 0.3067 h = 0.0245 -0.0652 -0.5010 -0.8225 -0.5010 -0.0652 0.0245 Aim: Design a FIR filter 4. Band stop filter Mathematical Expressions Required: Wc = 2π(fc / fs) Hd(w) = Inputs: Wc1=pi/4 , wc2=pi/6 m=7 Analysis/ Learning outcomes This experiment give me a better understanding of band pass filter and helps me to understand its working graphically
  • 6. Program Codes: function[]=bsfshyam(wc1,wc2,N) i=(N-1)/2; wn1=wc1/pi; wn2=wc2/pi; syms w for n=-i:i y(n+i+1)=(1/2*pi)*(int(exp(j*w*n),-pi,-wc2)+int(exp(j*w*n),- wc1,wc1)+int(exp(j*w*n),wc2,pi)); end y=sym2poly(y) for n=0:N-1 w(n+1)=0.54-0.46*cos(2*pi*n/(N-1)); h(n+1)=y(n+1).*w(n+1); end h=sym2poly(h) fir1(N-1,wn1) end Outputs/ Graphs/ Plots: >> bsfshyam(pi/4,pi/6,7) y = -0.3067 0.2104 0.6506 10.6921 0.6506 0.2104 -0.3067 h = -0.0245 0.0652 0.5010 10.6921 0.5010 0.0652 -0.0245 Analysis/ Learning outcomes This experiment give me a better understanding of band stop filter and helps me to understand its working graphically