%采样频率
Fs = 8000;
% 通带和阻带截至频率
fp = 1500; fs = 3000;
% 归一化的通带和阻带频率
wp = fp/(Fs/2); ws = fs/(Fs/2); %
% 通带和阻带衰减
rp = 3; rs = 10;
% 估计Butterworth 滤波器的阶次和频率
[n,wn] = buttord(wp,ws,rp,rs);
[b,a] = butter(n,wn);
[h,f] = freqz(b,a,512,Fs);
subplot(211),plot(f,20*log(abs(h)));grid;
xlabel('Frequency /Hz'); ylabel('Magnitude');title('幅频特性')
subplot(212),plot(f,unwrap(angle(h)));grid;
xlabel('Frequency /Hz'); ylabel('Phase');title('相频特性')