www.gusucode.com > signal 案例源码程序 matlab代码 > signal/MagnitudeResponseOfAHighpassFilterExample.m

    %% Magnitude Response of a Highpass Filter
% Design a 3rd-order highpass Butterworth filter having a normalized 3-dB frequency 
% of $0.5\pi$ rad/sample. Compute its frequency response. Express the magnitude 
% response in decibels and plot it.

% Copyright 2015 The MathWorks, Inc.


[b,a] = butter(3,0.5,'high');
[h,w] = freqz(b,a);

dB = mag2db(abs(h));

plot(w/pi,dB)
xlabel('\omega / \pi')
ylabel('Magnitude (dB)')
ylim([-82 5])
%% 
% Repeat the computation using |fvtool|.

fvtool(b,a)