Wednesday, April 13, 2011
1
matlab program for fir filter low pass matlab program for fir low pass filter
matlab program for fir low pass filter
w=input('enter cut off frequency in hertz');
N=input('enter number of samples');
wc=2*pi*w;
alpha=(N-1)/2;
eps=.001;
for n=0:1:N-1;
hd(n+1)=sin(wc*(n-alpha+eps))/(pi*(n-alpha+eps));
end
wr=ones(1,N);
hn=hd.*wr;
w=0:.01:pi;
h=freqz(hn,1,w); %frequency response
%absolute value
subplot(131)
plot(w/pi,abs(h),'r');
grid;
xlabel('normalised frequency');
ylabel('magnitude');
title('absolute value');
%angle plotting
subplot(132)
plot(w/pi,angle(h),'g');
grid;
xlabel('normalised frequency');
ylabel('magnitude');
title('angle');
%log plotting
subplot(133)
plot(w/pi,20*log(h),'b');
grid;
xlabel('normalised frequency');
ylabel('log magnitude');
title('log magnitude');
output
enter cut off frequency .25
enter number of samples 25
w=input('enter cut off frequency in hertz');
N=input('enter number of samples');
wc=2*pi*w;
alpha=(N-1)/2;
eps=.001;
for n=0:1:N-1;
hd(n+1)=sin(wc*(n-alpha+eps))/(pi*(n-alpha+eps));
end
wr=ones(1,N);
hn=hd.*wr;
w=0:.01:pi;
h=freqz(hn,1,w); %frequency response
%absolute value
subplot(131)
plot(w/pi,abs(h),'r');
grid;
xlabel('normalised frequency');
ylabel('magnitude');
title('absolute value');
%angle plotting
subplot(132)
plot(w/pi,angle(h),'g');
grid;
xlabel('normalised frequency');
ylabel('magnitude');
title('angle');
%log plotting
subplot(133)
plot(w/pi,20*log(h),'b');
grid;
xlabel('normalised frequency');
ylabel('log magnitude');
title('log magnitude');
output
enter cut off frequency .25
enter number of samples 25
tags:fir low pass filter using matlab matlab fir lpf fir filter design using matlab matlab program for fir lpf design
This post was written by: noufel n backer
Subscribe to:
Post Comments (Atom)
1 Responses to “matlab program for fir filter low pass matlab program for fir low pass filter”
March 28, 2012 at 12:28 AM
thanks so much this has pproved very helpful for me
Post a Comment