Wednesday, April 13, 2011
0
matlab program for fir hpf filter high pass filter fir design using matlab
matlab program for fir high pass filter
clear all;
w=input('enter cut off fre in hertz');
N=input('no of samples');
wc=2*pi*w;
alpha=(N-1)/2;
eps=.001;
for n=0:1:N-1
hd(n+1)=(sin(pi*(n-alpha+eps))-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);
%absolute value plotting
subplot(131);
plot(w/pi,abs(h),'r');
grid;
xlabel('normalised freq');
ylabel('mag');
title('abs');
subplot(132);
plot(w/pi,angle(h),'g');
xlabel('normalised freq');
ylabel('mag');
title('angle');
%log magn plot
subplot(133);
plot(w/pi,20*log10(h),'b');
grid;
xlabel('normalised freq');
ylabel('log mag');
title('log mag');
output
enter frequency .25
enter number of samples 25
tags:fir hpf implementation using matlab matlab program for fir high pass filter design
clear all;
w=input('enter cut off fre in hertz');
N=input('no of samples');
wc=2*pi*w;
alpha=(N-1)/2;
eps=.001;
for n=0:1:N-1
hd(n+1)=(sin(pi*(n-alpha+eps))-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);
%absolute value plotting
subplot(131);
plot(w/pi,abs(h),'r');
grid;
xlabel('normalised freq');
ylabel('mag');
title('abs');
subplot(132);
plot(w/pi,angle(h),'g');
xlabel('normalised freq');
ylabel('mag');
title('angle');
%log magn plot
subplot(133);
plot(w/pi,20*log10(h),'b');
grid;
xlabel('normalised freq');
ylabel('log mag');
title('log mag');
output
enter frequency .25
enter number of samples 25
tags:fir hpf implementation using matlab matlab program for fir high pass filter design
This post was written by: noufel n backer
Subscribe to:
Post Comments (Atom)
0 Responses to “matlab program for fir hpf filter high pass filter fir design using matlab”
Post a Comment