📄 butterworth.asv
字号:
clear all
close all
clc
n=0:0.01:2;
nfft=128;
Fs=44;
As=30;
Ap=0.5;
typeo=4;
switch typeo
case 1
type='bandpass';
case 2
type='stop';
case 3
type='high';
case 4
type='low';
end
if typeo==1
Wp=[0.15*pi,0.35*pi];
Ws=[0.1*pi,0.4*pi];
elseif typeo==2
Ws=[0.15*pi,0.35*pi];
Wp=[0.1*pi,0.4*pi];
elseif typeo==3
Wp=0.4*pi;
Ws=0.3*pi;
elseif typeo==4
Wp=0.6*pi;
Ws=0.8*pi;
end
[N,wn]=buttord(Wp/pi,Ws/pi,Ap,As);
[b,a,k]=butter(N,wn,type,'z');
[b,a]=zp2tf(b,a,k);
[h,f,s]=freqz(b,a,nfft,Fs,'whole');
% s.yunits='square'
% freqzplot(h,f,s)
plot([0:127]/128,abs(h))
axis([0 0.5 0 1])
grid
title('Butterworth数字滤波器')
grid
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -