Main Content

measure

Measure frequency response characteristics of filter System object

Description

measure(sysobj) displays measurements of various quantities from the frequency response of the filter System object™, sysobj. Measurements include the actual passband ripple, the minimum stopband attenuation, the frequency point at which the filter's gain is 3 dB below the nominal passband gain, etc. You must construct sysobj using fdesign and design with the name-value pair argument SystemObject=true. You can optionally specify additional options by one or more Name,Value pair arguments.

example

M = measure(sysobj) returns the measurements, M, such that the measurements can be queried programmatically. For example, to query the 3 dB point, type M.F3dB. Type get(M) to see the full list of properties that can be queried. Note that different filter responses generate different measurements.

M = measure(sysobj,Arithmetic=arithType) analyzes the filter System object, sysobj, based on the arithmetic specified in the arithType input. arithType can be set to one of 'double', 'single', or 'fixed'. When the arithmetic input is not specified and the filter System object is in an unlocked state, the analysis tool assumes a double precision filter.

M = measure(sysobj,freqspec= freqspecvalue) passes the frequency value as an input to measure in order to determine the corresponding magnitude measurements. For designs that do not specify some of the frequency constraints, you can determine the corresponding magnitude measurements using this option.

In the following example, the passband edge, passband ripple, and the transition width of the IIR filter are unknown.

 designLowpass = fdesign.lowpass('N,F3dB,Ast',8,0.5,80);
 chebFilter = design(designLowpass,'cheby2');
 measure(chebFilter)
Sample Rate      : N/A (normalized frequency)
Passband Edge    : Unknown                   
3-dB Point       : 0.5                       
6-dB Point       : 0.51823                   
Stopband Edge    : 0.68727                   
Passband Ripple  : Unknown                   
Stopband Atten.  : 79.9994 dB                
Transition Width : Unknown        
Specify the passband edge to be 0.4, and measure the passband ripple and the transition width of this filter.
 measure(chebFilter,Fpass=0.4)
Sample Rate      : N/A (normalized frequency)
Passband Edge    : 0.4                       
3-dB Point       : 0.5                       
6-dB Point       : 0.51823                   
Stopband Edge    : 0.68727                   
Passband Ripple  : 0.013644 dB               
Stopband Atten.  : 79.9994 dB                
Transition Width : 0.28727   

Examples

collapse all

Create a lowpass filter and check whether the actual filter meets the specifications. For this case, use normalized frequency for Fs, the default setting.

desigLowpass = fdesign.lowpass('Fp,Fst,Ap,Ast',0.45,0.55,0.1,80)
desigLowpass = 
  lowpass with properties:

               Response: 'Lowpass'
          Specification: 'Fp,Fst,Ap,Ast'
            Description: {4x1 cell}
    NormalizedFrequency: 1
                  Fpass: 0.4500
                  Fstop: 0.5500
                  Apass: 0.1000
                  Astop: 80

designmethods(desigLowpass,SystemObject=true)
Design Methods that support System objects for class fdesign.lowpass (Fp,Fst,Ap,Ast):


butter
cheby1
cheby2
ellip
equiripple
ifir
kaiserwin
multistage

Use the default equiripple design method.

equiFilter = design(desigLowpass,SystemObject=true)
equiFilter = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form'
      NumeratorSource: 'Property'
            Numerator: [-1.0186e-05 -6.8148e-04 -0.0017 -0.0014 7.3963e-04 0.0016 -7.5529e-04 -0.0022 7.2547e-04 0.0032 -5.6662e-04 -0.0044 2.2997e-04 0.0058 3.4013e-04 -0.0077 -0.0012 0.0098 0.0025 -0.0125 -0.0043 0.0157 0.0069 ... ] (1x70 double)
    InitialConditions: 0

  Use get to show all properties

Measure the specifications of the designed lowpass filter.

measure(equiFilter)
ans = 
Sample Rate      : N/A (normalized frequency)
Passband Edge    : 0.45                      
3-dB Point       : 0.47798                   
6-dB Point       : 0.48913                   
Stopband Edge    : 0.55                      
Passband Ripple  : 0.095021 dB               
Stopband Atten.  : 80.1164 dB                
Transition Width : 0.1                       
 

Stopband Edge, Passband Edge, Passband Ripple, and Stopband Attenuation all meet the specifications.

Now, using Fs in linear frequency, create a bandpass filter, and measure the magnitude response characteristics.

designBandpass = fdesign.bandpass
designBandpass = 
  bandpass with properties:

               Response: 'Bandpass'
          Specification: 'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2'
            Description: {7x1 cell}
    NormalizedFrequency: 1
                 Fstop1: 0.3500
                 Fpass1: 0.4500
                 Fpass2: 0.5500
                 Fstop2: 0.6500
                 Astop1: 60
                  Apass: 1
                 Astop2: 60

Convert to Linear Frequency.

normalizefreq(designBandpass,false,1.5e3)
bpFilter = design(designBandpass,'cheby2',SystemObject=true);

Measure the specifications of the designed bandpass filter.

measure(bpFilter)
ans = 
Sample Rate             : 1.5 kHz    
First Stopband Edge     : 262.5 Hz   
First 6-dB Point        : 319.9585 Hz
First 3-dB Point        : 324.9744 Hz
First Passband Edge     : 337.5 Hz   
Second Passband Edge    : 412.5 Hz   
Second 3-dB Point       : 425.0256 Hz
Second 6-dB Point       : 430.0415 Hz
Second Stopband Edge    : 487.5 Hz   
First Stopband Atten.   : 60 dB      
Passband Ripple         : 0.17985 dB 
Second Stopband Atten.  : 60 dB      
First Transition Width  : 75 Hz      
Second Transition Width : 75 Hz      
 

Measure the frequency response characteristics of a highpass filter. Create a dsp.HighpassFilter System object with default properties. Measure the frequency response characteristics of the filter.

HPF = dsp.HighpassFilter
HPF = 
  dsp.HighpassFilter with properties:

               FilterType: 'FIR'
    DesignForMinimumOrder: true
        StopbandFrequency: 8000
        PassbandFrequency: 12000
      StopbandAttenuation: 80
           PassbandRipple: 0.1000
      NormalizedFrequency: false
               SampleRate: 44100

  Use get to show all properties

HPFMeas = measure(HPF)
HPFMeas = 
Sample Rate      : 44.1 kHz   
Stopband Edge    : 8 kHz      
6-dB Point       : 10.418 kHz 
3-dB Point       : 10.8594 kHz
Passband Edge    : 12 kHz     
Stopband Atten.  : 81.8558 dB 
Passband Ripple  : 0.08066 dB 
Transition Width : 4 kHz      
 

Measure the frequency response characteristics of a lowpass filter. Create a dsp.LowpassFilter System object with default properties. Measure the frequency response characteristics of the filter.

LPF = dsp.LowpassFilter
LPF = 
  dsp.LowpassFilter with properties:

               FilterType: 'FIR'
    DesignForMinimumOrder: true
        PassbandFrequency: 8000
        StopbandFrequency: 12000
           PassbandRipple: 0.1000
      StopbandAttenuation: 80
      NormalizedFrequency: false
               SampleRate: 44100

  Use get to show all properties

LPFMeas = measure(LPF)
LPFMeas = 
Sample Rate      : 44.1 kHz  
Passband Edge    : 8 kHz     
3-dB Point       : 9.1311 kHz
6-dB Point       : 9.5723 kHz
Stopband Edge    : 12 kHz    
Passband Ripple  : 0.08289 dB
Stopband Atten.  : 81.6141 dB
Transition Width : 4 kHz     
 

Input Arguments

collapse all

Input filter, specified as one of the following filter System objects:

When sysobj is a generic discrete-time filter, for example, a single-rate lowpass filter, measure(sysobj) returns the following filter specifications.

Lowpass Filter Specification

Description

Sample Rate

Filter sampling frequency.

Passband Edge

Location of the edge of the passband as it enters transition.

3-dB Point

Location of the –3 dB point on the response curve.

6-dB Point

Location of the –6 dB point on the response curve.

Stopband Edge

Location of the edge of the transition band as it enters the stopband.

Passband Ripple

Ripple in the passband.

Stopband Atten

Attenuation in the stopband.

Transition Width

Width of the transition between the passband and stopband, in normalized frequency or absolute frequency. Measured between Fpass and Fstop.

When sysobj is a bandstop filter, measure(sysobj) returns these specifications for the resulting bandstop filter.

Bandstop Filter Specification

Description

Sample Rate

Filter sampling frequency.

First Passband Edge

Location of the edge of the first passband.

First 3-dB Point

Location of the edge of the –3 dB point in the first transition band.

First 6-dB Point

Location of the edge of the –6 dB point in the first transition band.

First Stopband Edge

Location of the start of the stopband.

Second Stopband Edge

Location of the end of the stopband.

Second 6-dB Point

Location of the edge of the –6 dB point in the second transition band.

Second 3-dB Point

Location of the edge of the –3 dB point in the second transition band.

Second Passband Edge

Location of the start of the second passband.

First Passband Ripple

Ripple in the first passband.

Stopband Atten

Attenuation in the stopband.

Second Passband Ripple

Ripple in the second passband.

First Transition Width

Width of the first transition region. Measured between the –3 and –6 dB points.

Second Transition Width

Width of the second transition region. Measured between the –6 and –3 dB points.

When sysobj is an interpolator, decimator, or a rate converter, measure(sysobj) returns these specifications for the resulting filter.

Interpolator Filter Specification

Description

Sample Rate

Filter sampling frequency.

First Passband Edge

Location of the edge of the passband as it enters transition.

3-dB Point

Location of the –3 dB point on the response curve.

6-dB Point

Location of the –6 dB point on the response curve.

Stopband Edge

Location of the edge of the transition band as it enters the stopband.

Passband Ripple

Ripple in the passband.

Stopband Atten

Attenuation in the stopband.

Transition Width

Width of the transition between the passband and stopband, in normalized frequency or absolute frequency. Measured between Fpass and Fstop.

Arithmetic used in the filter analysis, specified as 'double', 'single', or 'Fixed'. When the arithmetic input is not specified and the filter System object is unlocked, the analysis tool assumes a double-precision filter. When the arithmetic input is not specified and the System object is locked, the function performs the analysis based on the data type of the locked input.

The 'Fixed' value applies to filter System objects with fixed-point properties only.

When the 'Arithmetic' input argument is specified as 'Fixed' and the filter object has the data type of the coefficients set to 'Same word length as input', the arithmetic analysis depends on whether the System object is unlocked or locked.

  • unlocked –– The analysis object function cannot determine the coefficients data type. The function assumes that the coefficients data type is signed, has a 16-bit word length, and is auto scaled. The function performs fixed-point analysis based on this assumption.

  • locked –– When the input data type is 'double' or 'single', the analysis object function cannot determine the coefficients data type. The function assumes that the data type of the coefficients is signed, has a 16-bit word length, and is auto scaled. The function performs fixed-point analysis based on this assumption.

To check if the System object is locked or unlocked, use the isLocked function.

When the arithmetic input is specified as 'Fixed' and the filter object has the data type of the coefficients set to a custom numeric type, the object function performs fixed-point analysis based on the custom numeric data type.

Frequency specifications are input to measure in order to determine the corresponding magnitude measurements. For designs that do not specify some of the frequency constraints, you can determine the corresponding magnitude measurements using this option.

In the following example, the passband edge, passband ripple, and the transition width of the IIR filter are unknown.

 designLowpass = fdesign.lowpass('N,F3dB,Ast',8,0.5,80);
 chebFilter = design(designLowpass,'cheby2');
 measure(chebFilter)
Sample Rate      : N/A (normalized frequency)
Passband Edge    : Unknown                   
3-dB Point       : 0.5                       
6-dB Point       : 0.51823                   
Stopband Edge    : 0.68727                   
Passband Ripple  : Unknown                   
Stopband Atten.  : 79.9994 dB                
Transition Width : Unknown        
Specify the passband edge to be 0.4, and measure the passband ripple and the transition width of this filter.
 measure(chebFilter,Fpass=0.4)
Sample Rate      : N/A (normalized frequency)
Passband Edge    : 0.4                       
3-dB Point       : 0.5                       
6-dB Point       : 0.51823                   
Stopband Edge    : 0.68727                   
Passband Ripple  : 0.013644 dB               
Stopband Atten.  : 79.9994 dB                
Transition Width : 0.28727   

Output Arguments

collapse all

Measurements object, returned as an fdesign object. Here is a list of supported input filter objects with their corresponding fdesign measurements objects:

The measurements, M can be queried programmatically. For example, to query the 3 dB point, type M.F3dB. Type get(M) to see the full list of properties that can be queried. Note that different filter responses generate different measurements.

Tips

For designs that do not specify some of the frequency constraints, the function may not be able to determine corresponding magnitude measurements. In these cases, a constraint can be passed in to measure to determine such measurements. For example:

f = fdesign.lowpass('N,F3dB,Ast',8,0.5,80);
H = design(f,'cheby2',SystemObject=true);
measure(H)
returns values of Unknown for the passband edge, passband ripple, and transition width measurements, but

f = fdesign.lowpass('N,F3dB,Ast',8,0.5,80);
H = design(f,'cheby2',SystemObject=true);
measure(H,Fpass=0.4)
provides measurements for all returned values.

Version History

Introduced in R2011a

See Also

Functions