Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
25 views1 page

FIR Design

The document describes the design and frequency response analysis of a Low Pass Filter (LPF) and a High Pass Filter (HPF) using FIR filter design with a Hamming window. It includes code for generating the filters, calculating their frequency responses, and plotting the results. Key parameters such as cutoff frequency, sampling frequency, and filter order are specified for both filters.

Uploaded by

marathiclasher
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

FIR Design

The document describes the design and frequency response analysis of a Low Pass Filter (LPF) and a High Pass Filter (HPF) using FIR filter design with a Hamming window. It includes code for generating the filters, calculating their frequency responses, and plotting the results. Key parameters such as cutoff frequency, sampling frequency, and filter order are specified for both filters.

Uploaded by

marathiclasher
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

clc;

clear all;
close all;
fc= 200;
fs= 1200;
N=25;
Wc=(2*pi*fc/fs);

%1) LPF
b=fir1(N,Wc/pi, hamming(N+1));
w=0:0.01:pi;
[h,w]= freqz(b,1,w);
%W=angular frequency
m = 20*log10(abs(h));
subplot(2,1,1);
plot(w/pi,m);
xlabel('Normalised frequency response');
ylabel('Gain in dB');
subplot(2,1,2);
plot(w/pi,angle(h))

%2) HPF
clc;
clear;
close all;
% Filter specifications
fs = 1000; % Sampling frequency in Hz
fc = 200; % Cutoff frequency in Hz
n = 50; % Filter order (must be even for Type 1 FIR)
% Normalize cutoff frequency
wn = fc / (fs / 2);
% Design Highpass FIR filter using Hamming window
b = fir1(n, wn, 'high', hamming(n+1));
% Frequency response
[H, w] = freqz(b, 1, 1024, fs);
% Plot frequency response
figure;
plot(w, abs(H));
title('Magnitude Response of FIR Highpass Filter');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
grid on;

You might also like