view m-toolbox/classes/@mfir/fromPzmodel.m @ 19:69e3d49b4b0c
database-connection-manager
Update ltpda_uo.fromRepository
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ − % Construct an mfir from a pzmodel
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % FUNCTION: fromPzmodel
+ − %
+ − % DESCRIPTION: Construct an mfir from a pzmodel
+ − %
+ − % CALL: f = fromPzmodel(f, pli)
+ − %
+ − % PARAMETER: type: String with filter type description
+ − % pli: Parameter list object
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ −
+ − function f = fromPzmodel(f, pli)
+ −
+ − VERSION = '$Id: fromPzmodel.m,v 1.15 2011/08/15 11:43:01 hewitson Exp $';
+ − ii = mfir.getInfo('mfir', 'From Pzmodel');
+ − % Set the method version string in the minfo object
+ − ii.setMversion([VERSION '-->' ii.mversion]);
+ −
+ − % Add default values
+ − pl = applyDefaults(ii.plists, pli);
+ −
+ − % Get parameters
+ − pzm = find(pl, 'pzmodel');
+ − fs = find(pl, 'fs');
+ −
+ − if isempty(fs)
+ − % get max freq in pzmodel
+ − fs = 8*getupperFreq(pzm);
+ − warning([sprintf('!!! no sample rate specified. Designing for fs=%2.2f Hz.', fs)...
+ − sprintf('\nThe filter will be redesigned later when used.')]);
+ − end
+ − % make MIIR filter
+ − f = tomfir(pzm, plist('fs', fs));
+ −
+ − % override default input plist values
+ − if isempty(pl.find('name'))
+ − pl.pset('name', sprintf('fir(%s)', pzm.name));
+ − end
+ − if isempty(pl.find('description'))
+ − pl.pset('description', pzm.description);
+ − end
+ − if isempty(pl.find('iunits'))
+ − pl.pset('iunits', pzm.iunits);
+ − end
+ − if isempty(pl.find('ounits'))
+ − pl.pset('ounits', pzm.ounits);
+ − end
+ −
+ − % Add history
+ − f.addHistory(ii, pl, [], pzm.hist);
+ −
+ − % Set remaining properties
+ − f.setObjectProperties(pl);
+ −
+ − end % End fromPzmodel