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.SOSFilter with properties:

            Structure: 'Direct form II'
    CoefficientSource: 'Property'
            Numerator: [18x3 double]
          Denominator: [18x3 double]
       HasScaleValues: true
          ScaleValues: [0.2535 0.2535 0.2437 0.2437 0.2353 0.2353 0.2283 0.2283 0.2226 0.2226 0.2181 0.2181 0.2148 0.2148 0.2126 0.2126 0.2116 0.2116 1]

  Use get to show all properties

hd2 = design(d,"cheby2",SystemObject=true)
hd2 = 
  dsp.SOSFilter with properties:

            Structure: 'Direct form II'
    CoefficientSource: 'Property'
            Numerator: [9x3 double]
          Denominator: [9x3 double]
       HasScaleValues: true
          ScaleValues: [0.7226 0.7226 0.6446 0.6446 0.5277 0.5277 0.3810 0.3810 0.2932 1]

  Use get to 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.

Version History

Introduced in R2011a

expand all