Main Content

fdesign.octave

(Removed) Octave filter specification

Compatibility

Note

The fdesign.octave filter specification object has been removed from DSP System Toolbox™. Use the octaveFilter (Audio Toolbox) System object™ instead. For more information on how to update your existing code, see Compatibility Considerations.

Syntax

d = fdesign.octave(l)
d = fdesign.octave(l, MASK)
d = fdesign.octave(l, MASK, spec)
d = fdesign.octave(..., Fs)

Description

d = fdesign.octave(l) constructs an octave filter specification object d, with l bands per octave. The default value for l is one.

Note

The filters created by fdesign.octave comply with the ANSI® S1.11-2004 and IEC 61260:1995 standards.

d = fdesign.octave(l, MASK) constructs an octave filter specification object d with l bands per octave and MASK specification for the FVTool. The available values for mask are:

  • 'class 0'

  • 'class 1'

  • 'class 2'

d = fdesign.octave(l, MASK, spec) constructs an octave filter specification object d with l bands per octave, MASK specification for the FVTool, and the spec specification character vector. The specifications available are:

  • 'N, F0'

(not case sensitive), where:

  • N is the filter order

  • F0 is the center frequency. The center frequency is specified in normalized frequency units assuming a sampling frequency of 48 kHz, unless a sampling frequency in Hz is included in the specification: d = fdesign.octave(..., Fs). If you specify an invalid center frequency, a warning is issued and the center frequency is rounded to the nearest valid value. You can determine the valid center frequencies for your design by using validfrequencies with your octave filter specification object. For example:

    d = fdesign.octave(1,'Class 1','N,F0',6,1000,44.1e3);
    validcenterfreq = validfrequencies(d);
    Valid center frequencies:

    • Must be greater than 20 Hz and less than 20 kHz if you specify a sampling frequency. The range 20 Hz to 20 kHz is the standard range of human hearing.

    • Are calculated according to the following algorithm if the number of bands per octave, L, is even:

      G = 10^(3/10);
      x = -1000:1350;
      validcenterfreq = 1000*(G.^((2*x-59)/(2*L)));
      validcenterfreq = validcenterfreq(validcenterfreq>20 & validcenterfreq<2e4);

    • Are calculated according to the following algorithm if the number of bands per octave, L, is odd:

      G = 10^(3/10);
      x = -1000:1350;
      validcenterfreq = 1000*(G.^((x-30)/L));
      validcenterfreq = validcenterfreq(validcenterfreq>20 & validcenterfreq<2e4);

      Only center frequencies greater than 20 and less than 20,000 are retained. The center frequencies and the corresponding upper band frequencies must be less than the Nyquist frequency, which is half the sampling rate (samplingfreq). The vector of upper band frequencies (upperbandfreq) corresponding to the center frequencies (validcenterfreq) is computed using the following algorithm:

      upperbandfreq = validcenterfreq.*(G^(1/(2*L)));
      The algorithm removes the center frequencies whose corresponding upper band frequencies do not obey the Nyquist rule.
      validcenterfreq = validcenterfreq(upperbandfreq < samplingfreq/2);
      If you do not specify a sampling frequency, fdesign.octave assumes a samplingfreq of 48 kHz. To obtain valid normalized center frequencies, the remaining center frequencies are divided by 24,000.
      validcenterfreq = validcenterfreq/24000;

Examples

collapse all

Design a sixth order, octave-band class 0 filter with a center frequency of 1000 Hz and, a sampling frequency of 44.1 kHz.

d = fdesign.octave(1,'Class 0','N,F0',6,1000,44100)
d = octave with properties:
               Response: 'Octave and Fractional Octave'
         BandsPerOctave: 1
                   Mask: 'Class 0'
          Specification: 'N,F0'
            Description: {2x1 cell}
    NormalizedFrequency: 0
                     Fs: 44100
            FilterOrder: 6
                     F0: 1000

biquad = design(d,'SystemObject',true)
biquad = BiquadFilter with properties:
                   Structure: 'Direct form II'
             SOSMatrixSource: 'Property'
                   SOSMatrix: [3x6 double]
                 ScaleValues: [4x1 double]
           InitialConditions: 0
    OptimizeUnityScaleValues: true

  Show all properties

Plot the magnitude response of the filter using fvtool. The logarithmic scale for frequency is automatically set by fvtool for the octave filters.

fvtool(biquad)

Filter a sinusoidal signal using the above designed filter. The input is a sum of two tones - one at 0.3 kHz and the other at 3 kHz. Initialize a spectrum analyzer to view the filtered output power spectrum.

Fs = 2500;
Sineobject1 = dsp.SineWave('SamplesPerFrame',1024,...
    'SampleRate',Fs,'Frequency',100);
Sineobject2 = dsp.SineWave('SamplesPerFrame',1024,...
    'SampleRate',Fs,'Frequency',1000);

sa = spectrumAnalyzer('SampleRate',Fs,'NumInputPorts',2,...
    'PlotAsTwoSidedSpectrum',false,'YLimits',[-250,50],...
    'ChannelNames',{'Input','FilteredOutput'},'ShowLegend',true);

Stream the sinusoidal signal and pass it as an input to the biquadratic filter. View the input and the filtered output power spectra using the spectrum analyzer.

for Iter = 1:3000
    Sinewave1 = Sineobject1();
    Sinewave2 = Sineobject2();
    Input = Sinewave1 + Sinewave2;
    filteredOutput = biquad(Input);
    sa(Input,filteredOutput);
end

Version History

Introduced in R2011a

expand all

R2023b: fdesign.octave has been removed

The fdesign.octave filter specification object has been removed. Use the octaveFilter (Audio Toolbox) System object instead.

Update Code

This table shows how the object is typically used and explains how to update the existing code to use the octaveFilter object. The octaveFilter object requires Audio Toolbox™.

Discouraged UsageRecommended Replacement

Design a 6th order, 1/3rd octave-band Class 0 filter that is centered at 1000 Hz and has a sample rate of 44100 Hz.

    Fs = 44100;                               
    d = fdesign.octave(3,'Class 0','N,F0',6,1000,Fs)
    octFilt = design(d,'Systemobject',true);
    

Visualize the filter response and verify it fits within the Class 0 mask of the ANSI S1.11-2004 standard.

fvtool(octFilt,'Fs',44100,'FrequencyScale','log')

Design a 6th order, 1/3rd octave-band Class 0 filter that is centered at 1000 Hz and has a sample rate of 44100 Hz.

    Fs = 44100;
    octFilt = octaveFilter(1000,'1/3 octave',...
              'SampleRate',Fs);
 

Visualize the filter response and verify it fits within the Class 0 mask of the ANSI S1.11-2004 standard.

visualize(octFilt,'class 0');

See Also

Objects