www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/TwoEqualizersCenteredAtDifferentFrequenciesExample.m

    %% Two Equalizers Centered at Different Frequencies
% Design two equalizers centered at 100 Hz and 1000 Hz respectively,
% both with a gain of 5 dB and a Q-factor of 1.5, for a system running
% at 48 kHz.

% Copyright 2015 The MathWorks, Inc.

Fs  = 48e3;
N   = 6;
G   = 5;
Q   = 1.5;
Wo1 = 100/(Fs/2);
Wo2 = 1000/(Fs/2);
% Obtain the bandwidth of the equalizers from the center frequencies and
% Q-factors.
BW1 = Wo1/Q;
BW2 = Wo2/Q;
% Design the equalizers and obtain their SOS and SV values.
[SOS1,SV1] = iirparameq(N,G,Wo1,BW1);  
[SOS2,SV2] = iirparameq(N,G,Wo2,BW2);  

%%
% Design biquad filters using the obtained SOS and SV values.
BQ1 = dsp.BiquadFilter('SOSMatrix',SOS1,'ScaleValues',SV1);
BQ2 = dsp.BiquadFilter('SOSMatrix',SOS2,'ScaleValues',SV2);

%% 
% Plot the magnitude response of both filters using a log
% scale.
fvtool(BQ1,BQ2,'Fs',Fs,'FrequencyScale','Log');
legend('Equalizer centered at 100 Hz','Equalizer centered at 1000 Hz');