0% found this document useful (0 votes)
89 views3 pages

Experiment: 6 Basic Functions Using Matlab: AIM: Design A 20

The document describes an experiment to design a 20th order low pass filter (LPF) with MATLAB. The LPF has a passband frequency of 200Hz, stopband frequency of 400Hz, and sampling frequency of 1000Hz. It uses a rectangular window technique to calculate the filter coefficients. The magnitude and phase responses of the designed filter are then plotted and verified using MATLAB's inbuilt freqz function.

Uploaded by

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

Experiment: 6 Basic Functions Using Matlab: AIM: Design A 20

The document describes an experiment to design a 20th order low pass filter (LPF) with MATLAB. The LPF has a passband frequency of 200Hz, stopband frequency of 400Hz, and sampling frequency of 1000Hz. It uses a rectangular window technique to calculate the filter coefficients. The magnitude and phase responses of the designed filter are then plotted and verified using MATLAB's inbuilt freqz function.

Uploaded by

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

DATE:23/09/19

EXPERIMENT: 6
BASIC FUNCTIONS USING MATLAB

AIM: Design a 20​th order LPF with passband frequency=200Hz, stopband


frequency=400Hz, and sampling frequency=1000Hz, using a rectangular window
technique. Plot its magnitude and phase response.

THEORY:
A low-pass filter (LPF) is a ​filter​ that passes ​signals​ with a ​frequency​ lower than a
selected ​cut-off​ and ​attenuates​ signals with frequencies higher than the cut-off
frequency.

In ​signal processing​, a sinc filter is an idealized ​filter​ that removes all frequency components
above a given ​cut-off frequency​, without affecting lower frequencies, and has ​linear
phase​ response. The filter's ​impulse response​ is a ​sinc function​ in the time domain, and
its ​frequency response​ is a ​rectangular function​.

It is an "ideal" ​low-pass filter​ in the frequency sense, perfectly passing low frequencies,
perfectly cutting high frequencies; and thus may be considered to be a brick-wall filter.
PROGRAM:

%Low Pass Filter---------------------------------------------------------------------------------------------------------------

clc;
close ​all​;
clear ​all​;
M=20;​%length of filter
a=M/2;
fc=300;
wc=300/1000;
%Inbuit
Function----------------------------------------------------
b=fir1(20,(300/1000),rectwin(M+1))​%calculating cofficients of
rectangular filter

[H,w]=freqz(b,1,216);
q=abs(H)​%magnitude plot using inbuilt function

subplot(221)
plot(w/pi,q)
xlabel(​'Normalized Frequency'​)
ylabel(​'Magnitude(dB)'​)
title(​'Magnitude Plot using inbuilt function'​)

subplot(222)​%phase plot using inbuilt function


plot(w/pi,phase(H))
xlabel(​'Normalized Frequency'​)
ylabel(​'Phase(degrees)'​)
title(​'Phase Plot using inbuilt function'​)
%Implementing
Function----------------------------------------------
n=1:1:M+1;
h(n)=(sinc((n-a).*wc)).*(wc);​%calculation of cofficient of
h(n)
[H1,w]=freqz(h,1,512);

subplot(223)​%magnitude plot
plot(w/pi,abs(H1))
xlabel(​'Normalized Frequency'​)
ylabel(​'Magnitude(dB)'​)
title(​'Magnitude Plot'​)

subplot(224)​%phase plot
plot(w/pi,phase(H1))
xlabel(​'Normalized Frequency'​)
ylabel(​'Phase(degrees)'​)
title(​'Magnitude Plot'​)

OUTPUT:

CONCLUSION:
In the experiment we implemented the low pass filter with a given pass band and
stop band frequency, using a rectangular window technique. We plotted its
magnitude and phase response and verified the same using the inbuilt function.

You might also like