Module VIII: Butterworth filter design with different set of parameters
Butterworth Low pass filter polynomial table:
N Hp(s)
1 1/(s+1)
2 1/(s2+1.4142s+1)
3 1/(s3+2s2+2s+1)
4 1/(s4+2.6131s3+3.4142s2+2.6131s+1)
5 1/(s5+3.2361s4+5.2361s3+5.2361s2+3.2361s+1)
6 1/(s6+3.8637s5+704641s4+9.1416s3+7.4641s2+3.8637s+1)
Design an IIR filter for 4th order (LPF)
%% IIR Filter Design[(4th order),LPF]
%cutoff frequency =1500Hz
%sampling frequency =8000Hz
format long
fs=8000;%sampling rate
[B A]=lp2lp([1],[1,2.6131,3.4142,2.6131,1],1.0691*10^4);
[b a]=bilinear(B,A,fs);
figure('Name','LPF');
freqz(b,a,512,fs);
axis([0 fs/2 -20 1])
%% IIR Filter Design[(2nd order),BPF]
%sampling frequency =8000Hz
%Upper cutoff frequency =2.6kHz
%Lower cutoff frequency =2.4kHz
clc;
format long
fs=8000;%sampling rate
w0=sqrt(5.7499*10^8);
wB=4088;
[B A]=lp2bp([1],[1,1.414,1],w0,wB);
[b a]=bilinear(B,A,fs);
figure('Name','BPF');
freqz(b,a,512,fs);
axis([0 fs/2 -20 1])
%% IIR Filter Design[(2nd order),BSF]
%sampling frequency =8000Hz
%Upper cutoff frequency =2.6kHz
%Lower cutoff frequency =2.4kHz
clc;
format long
fs=8000;%sampling rate
w0=sqrt(5.7499*10^8);
wB=4088;
[B A]=lp2bs([1],[1,1.414,1],w0,wB);
[b a]=bilinear(B,A,fs);
figure('Name','BSF');
freqz(b,a,512,fs);
axis([0 fs/2 -20 1])
%% IIR Filter Design[(4th order),HPF]
%cutoff frequency =1500Hz
%sampling frequency =8000Hz
format long
fs=8000;%sampling rate
[B A]=lp2hp([1],[1,2.6131,3.4142,2.6131,1],1.0691*10^4);
[b a]=bilinear(B,A,fs);
figure('Name','HPF');
freqz(b,a,512,fs);
axis([0 fs/2 -20 1])
Problem:
Design a Low Pass digital Butterworth Filter for the given specifications: Alphap=0.4,
alphas=30, fp=400 Hz, fs=800 Hz, sampling frequency F=2000 Hz.
alphap=0.4;
alphas=30;
fp=400;
fs=800;
F=2000;
omp=2*fp/F;
oms=2*fs/F;
[n,wn]=buttord(omp,oms,alphap,alphas);
[b,a]=butter(n,wn);
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=abs(h);
an=angle(h);
subplot(2,1,1);
plot(om/pi,20*log(m));
xlabel('Normalized freq');
ylabel('Gain in dB');
title('****Butterworth LPF****');
subplot(2,1,2);
plot(om/pi,an);
xlabel('Normalized freq');
ylabel('Phase in radian');
Output:
n=4
wn = 0.5821