Products & Services Solutions Academia Support User Community Company

Learn more about Filter Design Toolbox   

measure - Measure filter magnitude response

Syntax

measure(hd)
measure(hm)

Description

measure(hd) returns measured values for specific points in the magnitude response curve for filter object hd. When you use a design object d to create a filter (by using fdesign.type to create d), you specify one or more values that define your desired filter response. measure(hd) tests the filter to determine the actual values in the magnitude response of the filter, such as the stopband attenuation or the passband ripple. Comparing the results returned by measure to the specifications you provided in the design object helps you assess whether the filter meets your design criteria.

measure(hd) returns specifications determined by the response type of the design object you use to create the filter. For example, for single-rate lowpass filters made from design objects, measure(hd) returns the following filter specifications.

Lowpass Filter Specification

Description

Sampling Frequency

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.

In contrast, when you use a bandstop design object, measure(hd) returns these specifications for the resulting bandstop filter.

Bandstop Filter Specification

Description

Sampling Frequency

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 Edge

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.

Filters from different filter responses return their designated sets of specifications. Also, whether the filter is single-rate or multirate changes the list of specifications that measure tests.

measure(hm) is the same as measure(hd), where hm is a multirate filter object. For multirate filters, the set of filter specifications that measure returns might be different from the discrete-filter set.

The set of response measurements that measure returns depends on the response you use to design the filter. When hm is an FIR lowpass interpolator (response is lowpass), for example, measure(hm) returns this set of measurements.

Interpolator Filter Specification

Description

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.

For reference, this is the specification object d that created the interpolator specifications shown in the preceding table.

d=fdesign.interpolator(6,'lowpass')
 
d =
 
          MultirateType: 'Interpolator'   
    InterpolationFactor: 6                
               Response: 'Lowpass'        
          Specification: 'Fp,Fst,Ap,Ast'  
            Description: {4x1 cell}       
    NormalizedFrequency: true             
                  Fpass: 0.133333333333333
                  Fstop: 0.166666666666667
                  Apass: 1                
                  Astop: 60   

Examples

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

d2=fdesign.lowpass('Fp,Fst,Ap,Ast',0.45,0.55,0.1,80)
 
d2 =
 
               Response: 'Lowpass'      
          Specification: 'Fp,Fst,Ap,Ast'
            Description: {4x1 cell}     
    NormalizedFrequency: true           
                  Fpass: 0.45           
                  Fstop: 0.55           
                  Apass: 0.1            
                  Astop: 80             
                                      
designmethods(d2)


Design Methods for class fdesign.lowpass (Fp,Fst,Ap,Ast):


butter
cheby1
cheby2
ellip
equiripple
ifir
kaiserwin
multistage

hd2=design(d2) % Use the default equiripple design method.
 
hd2 =
 
     FilterStructure: 'Direct-Form FIR'
          Arithmetic: 'double'         
           Numerator: [1x68 double]    
    PersistentMemory: false            

measure(hd2)

ans =
 
Sampling Frequency : N/A (normalized frequency)
Passband Edge      : 0.45                      
3-dB Point         : 0.47794                   
6-dB Point         : 0.48909                   
Stopband Edge      : 0.55                      
Passband Ripple    : 0.09615 dB                
Stopband Atten.    : 80.2907 dB                
Transition Width   : 0.1           

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

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

d=fdesign.bandpass
 
d =
 
               Response: 'Bandpass'                      
          Specification: 'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2'
            Description: {7x1 cell}                      
    NormalizedFrequency: true                            
                 Fstop1: 0.35                            
                 Fpass1: 0.45                            
                 Fpass2: 0.55                            
                 Fstop2: 0.65                            
                 Astop1: 60                              
                  Apass: 1                               
                 Astop2: 60                              
                                                         

normalizefreq(d,false,1.5e3) % Convert to linear freq.

hd=design(d,'cheby2');

measure(hd)

ans =
 
Sampling Frequency      : 1.5 kHz    
First Stopband Edge     : 0.2625 kHz 
First 6-dB Point        : 0.31996 kHz
First 3-dB Point        : 0.32497 kHz
First Passband Edge     : 0.3375 kHz 
Second Passband Edge    : 0.4125 kHz 
Second 3-dB Point       : 0.42503 kHz
Second 6-dB Point       : 0.43004 kHz
Second Stopband Edge    : 0.4875 kHz 
First Stopband Atten.   : 60 dB      
Passband Ripple         : 0.17985 dB 
Second Stopband Atten.  : 60 dB      
First Transition Width  : 0.075 kHz  
Second Transition Width : 0.075 kHz

measure(hd) returns the actual response values, in the units you chose. In this example, all frequencies appear in Hz because the sampling frequency is Hz.

See Also

design, fdesign, normalizefreq

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS