Design filter by Rectangular window function | Scigyan

Design filter by Rectangular window function

Matlab program to design filter by Rectangular window function.

Matlab code

clc; close all; clear all
Wc=.5*pi;
taps=25; % No of taps 
N=taps-1; % Filter order 
f=N/2;
eps=.001; n=0:N;
hd=sin(Wc*(n-f+eps))./(pi*(n-f+eps)); 
Wr=boxcar(taps);% Rectangular window 
hr=hd.*Wr'; % Filter coefficient 
[h,w]=freqz(hr,1,1024);
plot(w/pi,abs(h)); 
title('Magnitude Response'); 
ylabel('Magnitude');
xlabel('Normalised Frequency ( x pi rad/sample)-->'); 
legend('By Rectangular window')

Figure window

Filter-by-Rectangular-window
No comments:
Post a Comment

Related Posts Plugin for WordPress, Blogger...