Constructor examples of the MIIR class


Construct empty MIIR object
Construct a MIIR object by loading the object from a file
Construct a MIIR object from a parameter list (PLIST)
Construct a MIIR object from an existing model
Construct a MIIR object from a difference equation

Construct empty MIIR object

The following example creates an empty miir object

f = miir()
-------- None / $Id: miir.m,v 1.42 2008/03/24 23:51:38 mauro Exp ------------

created: 2008-03-30 17:46:47.858
version: $Id: miir.m,v 1.42 2008/03/24 23:51:38 mauro Exp
   name: None
     fs: 0
  ntaps: 0
      a:
      b:
   gain: 0
 histin:
histout:
Parameters:
----------- plist 01 -----------
n params: 0
--------------------------------

-------------------------------------------------------------------------------

Construct a MIIR object by loading the object from a file

The following example creates a new miir object by loading the miir object from disk.

f = miir('f.mat')
f = miir('f.xml')

Construct a MIIR object from a parameter list (PLIST)

Use the key word 'type'

Construct an MIIR of a standard type.

'type'

one of the types: 'highpass', 'lowpass', 'bandpass', 'bandreject' [default 'lowpass']

You can also specify optional parameters:

'gain'

The gain of the filter [default: 1]

'fc'

The roll-off frequency [default: 0.1 Hz]

'fs'

The sampling frequency to design for [default: 1 Hz]

'order'

The filter order [default: 1]

'ripple'

pass/stop-band ripple for bandpass and bandreject filters [default: 0.5]

The following example creates an order 64 highpass filter with high frequency gain 2. Filter is designed for 1 Hz sampled data and has a cut-off frequency of 0.2 Hz.

pl = plist('type', 'highpass',   ...
                   'order', 64,  ...
                   'gain',  2.0, ...
                   'fs',    1,   ...
                   'fc',    0.2);
f = miir(pl)

Furthermore it is possible to specify a spectral window.

win = specwin('Kaiser', 11, 150);
pl = plist('type', 'lowpass', ...
           'Win',   win,      ...
           'fs',    100,      ...
           'fc',    20,       ...
           'order', 10);

f = miir(pl)

Use the key word 'pzm'

The following example creates a miir object from a pole/zero model.

'pzmodel'

A pzmodel object to construct the filter from [default: empty pzmodel]

'fs'

Sample rate
[default: 8 * frequency of the highest pole or zero in the model]

ps = [pole(1) pole(200)];
zs = [zero(50)];
pzm = pzmodel(1, ps, zs);
pl = plist('pzmodel', pzm, 'fs', 1000);

f = miir(pl)

Construct a MIIR object from an existing model

The miir constructor also accepts as an input existing models in different formats:

LISO files

f = miir('foo_iir.fil')

XML files

f = miir('foo_iir.xml')

MAT files

f = miir('foo_iir.mat')

From repository

f = miir(plist('hostname', 'localhost', 'database', 'ltpda', 'ID', []))

Construct a MIIR object from a difference equation

Alternatively, the filter can be defined in terms of two vectors specifying the coefficients of the filter and the sampling frequency. The following example creates a IIR filter with sampling frequency 1 Hz and the following recursive equation:

a  = [0.5 -0.01];
b  = [1 0.1]
fs = 1;

f = miir(a,b,fs)




©LTP Team