filtstates.cic

www.kxcad.net Home > CAE Software Index > MATLAB Index >


Your Ad Here

Store CIC filter states

Description

filtstates.cic objects hold the states information for CIC filters. Once you create a CIC filter, the states for the filter are stored in filtstates.cic objects, and you can access them and change them as you would any property of the filter. This arrangement parallels that of the filtstates object that IIR direct-form I filters use (refer to filtstates for more information).

Each States property in the CIC filter comprises two properties — Numerator and Comb — that hold filtstates.cic objects. Within the filtstates.cic objects are the numerator-related and comb-related filter states. The states are column vectors, where each column represents the states for one section of the filter. For example, a CIC filter with four decimator sections and four interpolator sections has filtstates.cic objects that contain four columns of states each.

Examples

To show you the filtstates.cic object, create a CIC decimator and filter a signal.

hm=mfilt.cicdecim(5,2,4)
 
hm =
 
  FilterStructure: 'Cascaded Integrator-Comb Decimator'
       Arithmetic: 'fixed'
DifferentialDelay: 2
 NumberOfSections: 4
 DecimationFactor: 5
 PersistentMemory: false
 
  InputWordLength: 16              
  InputFracLength: 15              
                                           
SectionWordLengthMode: 'MinWordLengths'
                                           
hm.persistentMemory=true
 
hm =
 
 FilterStructure: 'Cascaded Integrator-Comb Decimator'
      Arithmetic: 'fixed'
DifferentialDelay: 2
 NumberOfSections: 4
 DecimationFactor: 5
 PersistentMemory: true
           States: Integrator: [4x1 States]
                         Comb: [4x1 States]
      InputOffset: 0
 
  InputWordLength: 16              
  InputFracLength: 15              
                                           
SectionWordLengthMode: 'MinWordLengths'

Use hm to filter some input data.

fs = 44.1e3;             % Original sampling frequency: 44.1kHz.
n = 0:10239;             % 10240 samples, 0.232 second long signal.
x  = sin(2*pi*1e3/fs*n); % Original signal, sinusoid at 1kHz.
y=filter(hm,x)

hm has nonzero states now.

s=hm.states
 
s =
 
    Integrator: [4x1 States]
          Comb: [4x1 States]

s.Integrator
 
ans =
 
  1.0e+003 *

    0.0043
   -2.0347
   -0.4175
    0.8206

s.Comb
 
ans =
 
  1.0e+003 *

   -3.1301
   -0.8493
   -2.5474
    1.7888
   -1.6253
    3.1981
    0.4729
    3.4559

You can use int to see the states as 32-bit integers.

int(s.Integrator)

ans =

      142435
    -8334019
     -427469
      210081

whos shows you the filtstates.cic object.

whos
  Name      Size                    Bytes  Class

  Fs        1x1                         8  double array
  ans       4x1                        16  int32 array
  hm        1x1                            mfilt.cicdecim
  n         1x10240                 81920  double array
  s         1x1                            filtstates.cic
  x         1x10240                 81920  double array
  y         1x2048                         embedded.fi

Grand total is 20488 elements using 163864 bytes

See Also

mfilt, mfilt.cicdecim, mfilt.cicinterp

filtstates in Signal Processing Toolbox documentation

  


© 1984-2007 The MathWorks, Inc. Terms of Use Patents Trademarks Acknowledgments

Your Ad Here