设计滤波器
image

% build filter
% sample rate
fs = 6250;
% cutoff frequency
fc = 1000;
% build a 6th-order highpass Butterworth filter with a cutoff frequency of 300 Hz,
[b a]=butter(2 ,fc/(fs/2),'high');

显示频响曲线
image

% show magnitude response
n = 512;
[h,w] = freqz(b,a,[0:(fs/n/2):fs/2],fs);
plot(w/1000,20*log10(abs(h)));
ylabel('Magnitude(dB)')
xlabel('Frequency(kHz)')
title('Magnitude Response(dB)');
grid on;