Products & Services Solutions Academia Support User Community Company

Learn more about Filter Design Toolbox   

normalize - Normalize filter numerator or feed-forward coefficients

Syntax

normalize(hq)
g = normalize(hd)

Description

normalize(hq) normalizes the filter numerator coefficients for a quantized filter to have values between -1 and 1. The coefficients of hq change — normalize does not copy hq and return the copy. To restore the coefficients of hq to the original values, use denormalize.

Note that for lattice filters, the feed-forward coefficients stored in the property lattice are normalized.

g = normalize(hd) normalizes the numerator coefficients for the filter hq to between -1 and 1 and returns the gain g due to the normalization operation. Calling normalize again does not change the coefficients. g always returns the gain returned by the first call to normalize the filter.

Examples

Create a direct form II quantized filter that uses second-order sections. Then use normalize to maximize the use of the range of representable coefficients.

d=fdesign.lowpass('n,fp,ap,ast',8,.5,2,40);
 
hd=design(d,'ellip');
 
hd
 
hd =
 
         FilterStructure: 'Direct-Form II, Second-Order Sections'                                    
              Arithmetic: 'double'                                                                   
               sosMatrix: [4x6 double]                                                               
             ScaleValues: [0.116791640438469;0.647874293162077;0.912408909495157;0.979110139688082;1]
     OptimizeScaleValues: true                                                                       
        PersistentMemory: false    
hd.arithmetic='fixed'
 hd =
 
         FilterStructure: 'Direct-Form II, Second-Order Sections'                                  
              Arithmetic: 'fixed'                                                                  
               sosMatrix: [4x6 double]                                                             
             ScaleValues: [0.116790771484375;0.64788818359375;0.91241455078125;0.979095458984375;1]
     OptimizeScaleValues: true                                                                     
        PersistentMemory: false                                                                    
                                                                                                   
         CoeffWordLength: 16             
          CoeffAutoScale: true           
                  Signed: true           
                                         
         InputWordLength: 16             
         InputFracLength: 15             
                                         
  SectionInputWordLength: 16             
   SectionInputAutoScale: true           
                                         
 SectionOutputWordLength: 16             
  SectionOutputAutoScale: true           
                                         
        OutputWordLength: 16             
              OutputMode: 'AvoidOverflow'
                                         
         StateWordLength: 16             
         StateFracLength: 15             
                                         
             ProductMode: 'FullPrecision'
                                         
               AccumMode: 'KeepMSB'      
         AccumWordLength: 40             
           CastBeforeSum: true           
                                         
               RoundMode: 'convergent'   
            OverflowMode: 'wrap'        

Check the filter coefficients. Note that hd.sosMatrix(1,2)>1

hd.sosMatrix

ans =

    1.0000    1.5132    1.0000    1.0000   -0.9207    0.4373
    1.0000    0.3867    1.0000    1.0000   -0.2779    0.8242
    1.0000    0.0929    1.0000    1.0000   -0.0514    0.9610
    1.0000    0.0339    1.0000    1.0000   -0.0020    0.9934

Use normalize to modify the coefficients into the range between -1 and 1. The output g contains the gains applied to each section of the SOS filter.

g = normalize(hd)

g =

    1.5132
    1.0000
    1.0000
    1.0000

hd.sosMatrix

ans =

    0.6608    1.0000    0.6608    1.0000   -0.9207    0.4373
    1.0000    0.3867    1.0000    1.0000   -0.2779    0.8242
    1.0000    0.0929    1.0000    1.0000   -0.0514    0.9610
    1.0000    0.0339    1.0000    1.0000   -0.0020    0.9934

None of the numerator coefficients exceed -1 or 1.

See Also

denormalize

  


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