www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/CompareNotchFiltersOfDifferentOrdersExample.m
%% Compare Notch Filters Designed with Different Orders % Design an eigth-order notch filter and compare it to a traditional % second-order notch filter designed with |IIRNOTCH|. % Copyright 2015 The MathWorks, Inc. Fs = 44.1e3; N = 8; G = -inf; Q = 1.8; Wo = 60/(Fs/2); % Notch at 60 Hz BW = Wo/Q; % Bandwidth occurs at -3 dB for this special case [SOS1,SV1] = iirparameq(N,G,Wo,BW); [NUM,DEN] = iirnotch(Wo,BW); SOS2 = [NUM,DEN]; %% % Design the notch filters using the SOS and SV values. BQ1 = dsp.BiquadFilter('SOSMatrix',SOS1,'ScaleValues',SV1); BQ2 = dsp.BiquadFilter('SOSMatrix',SOS2); %% % Plot the magnitude response of both filters. The filters % intersect at -3 dB point. FVT = fvtool(BQ1,BQ2,'Fs',Fs,'FrequencyScale','Log'); legend(FVT,'8th order notch filter','2nd order notch filter');