butterworth.asv

来自「包含FIR IIR窗函数法」· ASV 代码 · 共 46 行

ASV
46
字号
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 + =
减小字号Ctrl + -
显示快捷键?