Main Content

fdesign.parameq

(To be removed) Parametric equalizer filter specification

Compatibility

Note

The fdesign.parameq filter specification object will be removed in a future release. Existing instances of the object continue to run. For new code, use the designParamEQ function instead. For more information, see Compatibility Considerations.

Syntax

d = fdesign.parameq(spec, specvalue1, specvalue2, ...)
d = fdesign.parameq(... fs)

Description

d = fdesign.parameq(spec, specvalue1, specvalue2, ...) constructs a parametric equalizer filter design object, where spec is a non-case sensitive character vector. The choices for spec are as follows:

  • 'F0, BW, BWp, Gref, G0, GBW, Gp' (minimum order default)

  • 'F0, BW, BWst, Gref, G0, GBW, Gst'

  • 'F0, BW, BWp, Gref, G0, GBW, Gp, Gst'

  • 'N, F0, BW, Gref, G0, GBW'

  • 'N, F0, BW, Gref, G0, GBW, Gp'

  • 'N, F0, Fc, Qa, G0'

  • 'N, F0, Fc, S, G0'

  • 'N, F0 ,BW, Gref, G0, GBW, Gst'

  • 'N, F0, BW, Gref, G0, GBW, Gp, Gst'

  • 'N, Flow, Fhigh, Gref, G0, GBW'

  • 'N, Flow, Fhigh, Gref, G0, GBW, Gp'

  • 'N, Flow, Fhigh, Gref, G0, GBW, Gst'

  • 'N, Flow, Fhigh, Gref, G0, GBW, Gp, Gst'

where the parameters are defined as follows:

ParameterDefinitionUnit
BWBandwidth 
BWpPassband Bandwidth 
BWstStopband Bandwidth 
GrefReference Gaindecibels
G0Center Frequency Gaindecibels
GBWGain at which Bandwidth (BW) is measureddecibels
GpPassband Gaindecibels
GstStopband Gaindecibels
NFilter Order 
F0Center Frequency 
FcCutoff Frequency 
FhighHigher Frequency at Gain GBW 
FlowLower Frequency at Gain GBW 
QaQuality Factor 
SSlope Parameter for Shelving Filters 

Regardless of the specification chosen, there are some conditions that apply to the specification parameters. These are as follows:

  • Specifications for parametric equalizers must be given in decibels

  • To boost the input signal, set G0 > Gref; to cut, set Gref > G0

  • For boost: G0 > Gp > GBW > Gst > Gref; For cut: G0 < Gp < GBW < Gst < Gref

  • Bandwidth must satisfy: BWst > BW > BWp

d = fdesign.parameq(... fs) adds the input sampling frequency. fs must be specified as a scalar trailing the other numerical values provided, and is assumed to be in Hz.

Examples

collapse all

Design a Chebyshev Type II parametric equalizer filter that cuts by 12 dB.

parametricEQ = fdesign.parameq('N,Flow,Fhigh,Gref,G0,GBW,Gst', ...
    4,0.3,0.5,0,-12,-10,-1);

parametricEQBiquad = design(parametricEQ,'cheby2','SystemObject',true);
fvtool(parametricEQBiquad)

Design a 4th-order lowpass shelving filter with a normalized cutoff frequency of 0.25, a quality factor of 10, and an 8 dB boost gain.

parametricEQ  = fdesign.parameq('N,F0,Fc,Qa,G0',4,0,0.25,10,8);
parametricEQBiquad = design(parametricEQ,'SystemObject',true);
fvtool(parametricEQBiquad)

Design 4th-order highpass shelving filters with slopes of 1.5 and 3.

N  = 4;   % Filter order
F0 = 1;   % Center Frequency (normalized)
Fc = 0.4; % Cutoff Frequency (normalized)
G0 = 10;  % Center Frequency Gain (dB)

S1 = 1.5; % Slope for filter design 1
S2 = 3;   % Slope for filter design 2

filter = fdesign.parameq('N,F0,Fc,S,G0',N,F0,Fc,S1,G0);
filterDesignS1 = design(filter,'SystemObject',true);

filter.S = S2;
filterDesignS2 = design(filter,'SystemObject',true);

filterVisualization = fvtool(filterDesignS1,filterDesignS2);
legend(filterVisualization,'Slope = 1.5','Slope = 3');

Version History

collapse all

R2022a: fdesign.parameq will be removed

The fdesign.parameq filter specification object will be removed in a future release. Existing instances of the object continue to run. For new code, use the designParamEQ function instead.

Update Code

This table shows how the object is typically used and explains how to update the existing code to use the designParamEQ function.

Discouraged UsageRecommended Replacement

Design based on Filter Bandwidth

Fs  = 48e3;
N   = 2;
Q   = 10;
G   = 9; % 9 dB

% Normalized center frequency
Wo1 = 2000/(Fs/2); 
Wo2 = 12000/(Fs/2);

% Normalized bandwidth
BW1 = Wo1/Q; 
BW2 = Wo2/Q;

PEQ = fdesign.parameq('N,F0,BW,Gref,G0,GBW',N,Wo1,BW1,0,G,4.5);
BQ1 = design(PEQ,'SystemObject',true);

PEQ.BW = BW2;
PEQ.F0 = Wo2;
BQ2 = design(PEQ,'SystemObject',true);

% Visualize the filters
hfvt = fvtool(BQ1,BQ2,'Fs',Fs,'Color','white');
legend(hfvt,'BW1 = 200 Hz; Q = 10','BW2 = 1200 Hz; Q = 10');

Design based on Filter Bandwidth

Fs  = 48e3;
N   = 2;
Q   = 10;
G   = 9; % 9 dB

% Normalized center frequency
Wo1 = 2000/(Fs/2); 
Wo2 = 12000/(Fs/2);

% Normalized bandwidth
BW1 = Wo1/Q; 
BW2 = Wo2/Q;

[B1,A1] = designParamEQ(N,G,Wo1,BW1);
[B2,A2] = designParamEQ(N,G,Wo2,BW2);
BQ1 = dsp.BiquadFilter('SOSMatrix',[B1.',[1,A1.']]);
BQ2 = dsp.BiquadFilter('SOSMatrix',[B2.',[1,A2.']]);

% Visualize the filters
hfvt = fvtool(BQ1,BQ2,'Fs',Fs,'Color','white');
legend(hfvt,'BW1 = 200 Hz; Q = 10','BW2 = 1200 Hz; Q = 10');

Design based on Quality factor

Fs  = 48e3;
N   = 2;
G   = 15; % 15 dB

% Quality factor
Q1 = 0.48;
Q2 = 1/sqrt(2);

% Normalized center frequency
% F0 = 1 designs a highpass filter
% F0 can either be 0 or 1 in this configuration
F0 = 1;  

% Cutoff Frequency
Fc = 6e3/(Fs/2); 

PEQ = fdesign.parameq('N,F0,Fc,Qa,G0',N,F0,Fc,Q1,G);
BQ1 = design(PEQ,'SystemObject',true);

PEQ.Qa = Q2;
BQ2 = design(PEQ,'SystemObject',true);

% Visualize the filters
hfvt = fvtool(BQ1,BQ2,'Fs',Fs,'Color','white');
legend(hfvt,'Q = 0.48','Q = 0.7071');

Design based on Quality factor

Fs  = 48e3;
N   = 2;
G   = 15; % 15 dB

% Quality factor
Q1 = 0.48;
Q2 = 1/sqrt(2);

% Normalized center frequency
Wo  = 6000/(Fs/2); 

% Normalized bandwidth
BW1 = Wo/Q1; 
BW2 = Wo/Q2;

[B1,A1] = designParamEQ(N,G,Wo,BW1);
[B2,A2] = designParamEQ(N,G,Wo,BW2);
BQ1 = dsp.BiquadFilter('SOSMatrix',[B1.',[1,A1.']]);
BQ2 = dsp.BiquadFilter('SOSMatrix',[B2.',[1,A2.']]);

% Visualize the filters
hfvt = fvtool(BQ1,BQ2,'Fs',Fs,'Color','white');
legend(hfvt,'Q = 0.48','Q = 0.7071');

Low shelf and high shelf filters

Fs  = 48e3;
N   = 4;
G   = 10; % 10 dB

% Normalized center frequency
Wo1 = 0; % Lowpass filter
% Corresponds to Fs/2 (Hz) or pi (rad/sample)
Wo2 = 1; % Highpass filter

% Bandwidth occurs at 7.4 dB in this case
BW = 1000/(Fs/2); 

PEQ = fdesign.parameq('N,F0,BW,Gref,G0,GBW',N,Wo1,BW,0,G,3);
BQ1 = design(PEQ,'SystemObject',true);

PEQ.F0 = Wo2;
BQ2 = design(PEQ,'SystemObject',true);

% Visualize the filters
hfvt = fvtool(BQ1,BQ2,'Fs',Fs,'Color','white');
legend(hfvt,'Low Shelf Filter','High Shelf Filter');

Low shelf and high shelf filters

Fs  = 48e3;
N   = 4;
G   = 10; % 10 dB

% Normalized center frequency
Wo1 = 0; % Lowpass filter
% Corresponds to Fs/2 (Hz) or pi (rad/sample)
Wo2 = 1; % Highpass filter

% Bandwidth occurs at 7.4 dB in this case
BW = 1000/(Fs/2); 

[B1,A1] = designParamEQ(N,G,Wo1,BW);
[B2,A2] = designParamEQ(N,G,Wo2,BW);
BQ1 = dsp.BiquadFilter('SOSMatrix',[B1.',[ones(2,1),A1.']]);
BQ2 = dsp.BiquadFilter('SOSMatrix',[B2.',[ones(2,1),A2.']]);

% Visualize the filters
hfvt = fvtool(BQ1,BQ2,'Fs',Fs,'Color','white');
legend(hfvt,'Low Shelf Filter','High Shelf Filter');