The following example creates an empty mfir object
>> m = mfir ------ mfir/1 ------- gd: [] ntaps: 0 fs: [] infile: a: [] histout: [] hist: mfir [1x1 history] name: none created: 2008-08-22 14:08:33.711 [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_mfir_content.html,v 1.3 2008/08/22 15:33:51 hewitson Exp $ --> $Id: constructor_examples_mfir_content.html,v 1.3 2008/08/22 15:33:51 hewitson Exp $ --> $Id: constructor_examples_mfir_content.html,v 1.3 2008/08/22 15:33:51 hewitson Exp $ --> $Id: constructor_examples_mfir_content.html,v 1.3 2008/08/22 15:33:51 hewitson Exp $ --> $Id: constructor_examples_mfir_content.html,v 1.3 2008/08/22 15:33:51 hewitson Exp $ --------------------- >>
The following example creates a new mfir object by loading the mfir object from disk.
mf = mfir('mf.mat') mf = mfir('mf.xml')
An FIR filter can be generated based on the magnitude of the input Analysis Object or fsdata object. In the following example an fsdata object is first generated and then passed to the mfir constructor to obtain the equivalent FIR filter.
a1 = ao(plist('fsfcn', '1./(50+f)', 'f', linspace(0, 500, 1000))); a1.setFs(1000); mf = mfir(a1); iplot(a1, resp(mf));
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: 64] |
'win' |
Specify window function used in filter design [default: 'Hamming'] |
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 = mfir(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 = mfir(pl)
The following example creates a mfir object from a pole/zero model.
'pzmodel' |
A pzmodel object to construct the filter from [default: empty pzmodel] |
'fs' |
Sample rate |
pzm = pzmodel(1, [pz(1) pz(200)], pz(50)); pl = plist('pzmodel', pzm, 'fs', 1000); mf = mfir(pl)
Construct an MFIR based on the magnitude of the input AO/fsdata object a
'method' |
the design method: |
'win' |
Window function for frequency-sampling method |
'N' |
Filter order [default: 512] |
The following example creates a mfir object from an analysis object.
a1 = ao(plist('fsfcn', '1./(50+f)', 'f', linspace(0, 500, 1000)));
a1.setFs(1000);
pl = plist('ao', a1);
mf = mfir(pl)
The mfir constructor also accepts as an input existing filters stored in different formats:
LISO files
f = mfir('foo_fir.fil')
XML files
f = mfir('foo_fir.xml')
MAT files
f = mfir('foo_fir.mat')
From an LTPDA repository
f = mfir(plist('hostname', 'localhost', 'database', 'ltpda', 'ID', []))
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 FIR filter with sampling frequency 1 Hz and the following recursive equation:
b = [-0.8 10]; fs = 1; f = mfir(b,fs)