Main Content

freqrespopts

Create an options object for frequency response estimate

Description

example

opts = freqrespopts(sysobj) uses the current settings in the filter System object™ to create an options object. This object contains options for frequency response estimation. You pass the opts object as an input argument to the freqrespest function to specify values for the input parameters.

freqrespopts allows you to use the same settings for freqrespest with multiple filters without specifying all of the parameters as input arguments to freqrespest.

Examples

collapse all

This example uses the freqrespopts function to set options which are used by the freqrespest function. hd and hd2 are bandpass filters that use different design methods. The opts object makes it easier to set the same conditions for the frequency response estimate when using the freqrespest function with different filter objects..

d = fdesign.bandpass('fst1,fp1,fp2,fst2,ast1,ap,ast2',...
0.25,0.3,0.45,0.5,60,0.1,60);
hd = design(d,'butter','SystemObject',true)
hd = 
  dsp.BiquadFilter with properties:

                   Structure: 'Direct form II'
             SOSMatrixSource: 'Property'
                   SOSMatrix: [18x6 double]
                 ScaleValues: [19x1 double]
           InitialConditions: 0
    OptimizeUnityScaleValues: true

  Show all properties

hd2 = design(d,'cheby2','SystemObject',true)
hd2 = 
  dsp.BiquadFilter with properties:

                   Structure: 'Direct form II'
             SOSMatrixSource: 'Property'
                   SOSMatrix: [9x6 double]
                 ScaleValues: [10x1 double]
           InitialConditions: 0
    OptimizeUnityScaleValues: true

  Show all properties

opts = freqrespopts(hd)
opts =

  struct with fields:

             FreqPoints: 'All'
                   NFFT: 512
    NormalizedFrequency: true
                     Fs: 'Normalized'
          SpectrumRange: 'Half'
               CenterDC: false
opts.NFFT = 256; % Same as set(opts,'nfft',256).
opts.NormalizedFrequency = false;
opts.fs = 1.5e3;
opts.CenterDC = true
opts =

  struct with fields:

             FreqPoints: 'All'
                   NFFT: 256
    NormalizedFrequency: false
                     Fs: 1500
          SpectrumRange: 'Whole'
               CenterDC: true

With the opts object configured as needed, use it as an input argument for the freqrespest function.

[h2,w2] = freqrespest(hd2,20,opts);
[h1,w1] = freqrespest(hd,20,opts);

Output Arguments

collapse all

Options object which contains the options for frequency response estimation, returned as a pseudospectrum object. You pass the opts object as an input argument to the freqrespest function to specify values for input parameters.

Introduced in R2011a