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
M: running miir/miir
------ miir/1 -------
      b: []
 histin: []
  ntaps: 0
     fs: []
 infile: 
      a: []
histout: []
   hist: miir  [1x1 history]
   name: none
created: 2008-08-22 14:46:49.941 [1x1 time]
creator: created by hewitson@bobmac.aei.uni-hannover.de[130.75.117.65] on MACI/7.6 (R2008a)/1.9.1 beta (R2008a) [1x1 provenance]
version: $Id: constructor_examples_miir_content.html,v 1.3 2008/08/22 15:33:51 hewitson Exp $ --> $Id: constructor_examples_miir_content.html,v 1.3 2008/08/22 15:33:51 hewitson Exp $ --> $Id: constructor_examples_miir_content.html,v 1.3 2008/08/22 15:33:51 hewitson Exp $ --> $Id: constructor_examples_miir_content.html,v 1.3 2008/08/22 15:33:51 hewitson Exp $ --> $Id: constructor_examples_miir_content.html,v 1.3 2008/08/22 15:33:51 hewitson Exp $
---------------------

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]

pzm = pzmodel(1, [pz(1) pz(200)], pz(50));
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