Anda di halaman 1dari 8

Design an Analog butter worth highpass filter

with rp=0.2 dB of ripple in the passband, , and at


least rs=40 dB of attenuation in the stopband,
with ws=0.5 and wp=0.875. Plot the filter's
frequency response:
ws=0.5;
wp=0.875;
rp=0.2;
rs=40;
[N,WN]=buttord(wp,ws,rp,rs,'s');
[B,A]=butter(N,WN,'high','s');
w=0:0.01:pi;
[H1,om]=freqs(B,A,w);
m=20*log10(abs(H1));
an=angle(H1);
subplot(2,1,1);
plot(om/pi,m);
xlabel(' (a) Normalised
frequency');
ylabel(' Gain in dB');
title('BUTTERWORTH HIGH PASS
FILTER');
grid;
subplot(2,1,2);
plot(om/pi,an);
xlabel(' (b) Normalised
frequency');
Design an Analog CHEBYSHEV TYPE-1
highpass filter with rp=0.29 dB of ripple in the
passband, , and at least rs=29 dB of attenuation
in the stopband, with ws=0.24 and wp=0.35. Plot
the filter's frequency response:
MATLAB PROGRAM FOR FIR
FILTERS USING RECTANGULAR
WINDOW: clc; clear all; close all;
rp=0.04; rs=0.02; fp=1500;
fs=2000; f=8000; wp=2*fp/f;
ws=2*fs/f; wp ws num=-
20*log10(sqrt(rp*rs))-13;
dem=14.6*(fs-fp)/f;
n=ceil(num/dem); n1=n+1; if
(rem(n,2)~=0) n1=n; n=n-1; end
n1
%low pass filter y=boxcar(n1);
b=fir1(n,wp,y); [h,o]=freqz(b,1,256);
m=20*log10(abs(h)); subplot(2,2,1);
plot(o/pi,m); ylabel('Gain in dB -->');
xlabel('Normalised frequency');
%high pass filter y=boxcar(n1); n1
b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h)); subplot(2,2,2);
plot(o/pi,m); ylabel('Gain in dB -->');
xlabel('Normalised frequency');
%band pass filter wn=[wp ws];
y=boxcar(n1); wn n1 b=fir1(n,wn,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h)); subplot(2,2,3);
plot(o/pi,m); ylabel('Gain in dB -->');
xlabel('Normalised frequency');
%band stop filter wn=[wp ws];
y=boxcar(n1); n1
b=fir1(n,wn,'stop',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h)); subplot(2,2,4);
plot(o/pi,m); ylabel('Gain in dB -->');
xlabel('Normalised frequency');

Anda mungkin juga menyukai