Products & Services Solutions Academia Support User Community Company

Learn more about Filter Design Toolbox   

normalizefreq - Switch filter specification between normalized frequency and absolute frequency

Syntax

normalizefreq(d)
normalizefreq(d,flag)
normalizefreq(d,false,fs)

Description

normalizefreq(d) normalizes the frequency specifications in filter specifications object d. By default, the NormalizedFrequency property is set to true when you create a design object. You provide the design specifications in normalized frequency units. normalizefreq does not affect filters that already use normalized frequency.

If you use this syntax when d does not use normalized frequency specifications, all of the frequency specifications are normalized by fs/2 so they lie between 0 and 1, where fs is specified in the object. Included in the normalization are the filter properties that define the filter pass and stopband edge locations by frequency:

In this syntax, normalizefreq(d) assumes you specified fs when you created d or changed d to use absolute frequency specifications.

normalizefreq(d,flag) where flag is either true or false, specifies whether the NormalizedFrequency property value is true or false and therefore whether the filter normalizes the sampling frequency fs and other related frequency specifications. fs defaults to 1 for this syntax.

When you do not provide the input argument flag, it defaults to true. If you set flag to false, affected frequency specifications are multiplied by fs/2 to remove the normalization. Use this syntax to switch your filter between using normalized frequency specifications and not using normalized frequency specifications.

normalizefreq(d,false,fs) lets you specify a new sampling frequency fs when you set the NormalizedFrequency property to false.

Examples

These examples demonstrate using normalizefreq in both of the major syntax applications—setting the design object frequency specifications to use absolute frequency (normalizefreq(hd,false,fs)) and resetting a design object to using normalized frequencies (normalizefreq(d)).

Construct a highpass filter specifications object by specifying the passband and stopband edges and the desired attenuations in the bands. By default, provide the frequency specifications in normalized values between 0 and 1.

d=fdesign.highpass(0.35, 0.45, 60, 40)
 
d =
 
               Response: 'Highpass'     
          Specification: 'Fst,Fp,Ast,Ap'
            Description: {4x1 cell}     
    NormalizedFrequency: true           
                  Fstop: 0.35           
                  Fpass: 0.45           
                  Astop: 60             
                  Apass: 40             

Fstop and Fpass are in normalized form, and the property NormalizedFrequency is true.

Now use normalizedfreq to convert to absolute frequency specifications, with a sampling frequency of 1000 Hz.

normalizefreq(d,false,1e3)
d
 
d =
 
               Response: 'Highpass'     
          Specification: 'Fst,Fp,Ast,Ap'
            Description: {4x1 cell}     
    NormalizedFrequency: false          
                     Fs: 1000           
                  Fstop: 175            
                  Fpass: 225            
                  Astop: 60             
                  Apass: 40             

Both of the attenuation specifications remain the same. The passband and stopband edge definitions now appear in Hz, where the new value represents the normalized values multiplied by Fs/2, or 500 Hz.

Converting to using normalized frequencies consists of using normalizefreq with the design object d.

normalizefreq(d)
d
 
d =
 
               Response: 'Highpass'     
          Specification: 'Fst,Fp,Ast,Ap'
            Description: {4x1 cell}     
    NormalizedFrequency: true           
                  Fstop: 0.35           
                  Fpass: 0.45           
                  Astop: 60             
                  Apass: 40 

For bandstop, bandpass, and multiple band filter specifications objects, normalizefreq works the same way for all band edge definitions. When you do not provide the sampling frequency Fs as an input argument and you are converting to absolute frequency specifications, normalizefreq sets Fs to 1, as shown in this example.

d=fdesign.bandstop(0.25,0.35,0.55,0.65,50,60)
 
d =
 
               Response: 'Bandstop'                     
          Specification: 'Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2'
            Description: {7x1 cell}                     
    NormalizedFrequency: true                           
                 Fpass1: 0.25                           
                 Fstop1: 0.35                           
                 Fstop2: 0.55                           
                 Fpass2: 0.65                           
                 Apass1: 50                             
                  Astop: 60                             
                 Apass2: 50                             
                                                        
normalizefreq(d,false)
d
 
d =
 
               Response: 'Bandstop'                     
          Specification: 'Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2'
            Description: {7x1 cell}                     
    NormalizedFrequency: false                          
                     Fs: 1                              
                 Fpass1: 0.125                          
                 Fstop1: 0.175                          
                 Fstop2: 0.275                          
                 Fpass2: 0.325                          
                 Apass1: 50                             
                  Astop: 60                             
                 Apass2: 50     

See Also

fdesign.lowpass, fdesign.halfband, fdesign.highpass, fdesign.interpolator

  


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