Main Content

visualize

Visualize filter bank

Since R2024b

    Description

    visualize(filterBank) displays the magnitude response of the filter bank. You can update the plot by changing the properties of the filterBank object.

    example

    visualize(filterBank,ind) visualizes the selected filters from the filter bank.

    example

    visualize(___,N=n) uses n points to display the magnitude response. The default is 8096 points.

    example

    h = visualize(___) returns a handle to the visualizer.

    example

    Examples

    collapse all

    Create a 1/3-octave filter bank for a signal sampled at 48 kHz. Set the frequency range to [18 22000] Hz.

    octFiltBank = octaveFilterBank("1/3 octave",48000, ...
                                  FrequencyRange=[18 22000]);

    Visualize the response of the filter bank.

    visualize(octFiltBank)

    Change the bandwidth of the filter bank from 1/3 octave to 1 octave. See how the magnitude response visualization automatically updates.

    octFiltBank.Bandwidth = "1 octave";

    Create a default gammatone filter bank for a 16 kHz sample rate.

    gammaFiltBank = gammatoneFilterBank(SampleRate=16e3);

    Visualize the 3rd, 5th, and 10th filters in the filter bank.

    visualize(gammaFiltBank,[3 5 10])

    Visualize the same filters with only 64 points. See how the frequency resolution of the magnitude response decreases.

    visualize(gammaFiltBank,[3 5 10],N=64)

    Create a default gammatone filter bank for a 16 kHz sample rate.

    gammaFiltBank = gammatoneFilterBank(SampleRate=16e3);

    Visualize the filter bank and get a handle to the dsp.DynamicFilterVisualizer object.

    dfv = visualize(gammaFiltBank)

    dfv = 
      dsp.DynamicFilterVisualizer handle with properties:
    
                   FFTLength: 8192
         NormalizedFrequency: 0
                  SampleRate: 16000
              FrequencyRange: [50 8000]
                      XScale: 'Log'
            MagnitudeDisplay: 'Magnitude (dB)'
        PlotAsMagnitudePhase: 0
                    PlotType: 'Line'
                 AxesScaling: 'Manual'
    
      Show all properties
    
    

    Use the dsp.DynamicFilterVisualizer object to change properties of the filter bank plot. Set the XScale property to view the magnitude response on a linear frequency scale.

    dfv.XScale = "Linear";

    Input Arguments

    collapse all

    Filter bank object to visualize, specified as a gammatoneFilterBank or octaveFilterBank.

    Indices of filters to visualize, specified as a row vector of integers with values in the range [1, N], where N is the total number of filters in the filter bank.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Number of points in the magnitude response used to visualize the filters, specified as a positive integer.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Output Arguments

    collapse all

    Visualizer handle, returned as a dsp.DynamicFilterVisualizer object.

    Version History

    Introduced in R2024b