Mercurial > hg > ltpda
diff m-toolbox/classes/@miir/fromStandard.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@miir/fromStandard.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,55 @@ +% Construct an miir from a standard types +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% FUNCTION: fromStandard +% +% DESCRIPTION: Construct an miir from a standard types +% +% CALL: f = fromStandard(f, pli) +% +% PARAMETER: type: String with filter type description +% pli: Parameter list object +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function f = fromStandard(f, pli) + + VERSION = '$Id: fromStandard.m,v 1.16 2011/08/15 11:22:27 hewitson Exp $'; + + ii = miir.getInfo('miir', 'From Standard Type'); + % Set the method version string in the minfo object + ii.setMversion([VERSION '-->' ii.mversion]); + + % Add default values + pl = applyDefaults(ii.plists, pli); + + % Get parameters + type = find(pl, 'type'); + + % check and fill parameter list + plo = miir.parseFilterParams(pl); + switch lower(type) + case {'lowpass', 'low-pass', 'low pass'} + f = mklowpass(f, plo); + case {'highpass' 'high-pass', 'high pass'} + f = mkhighpass(f, plo); + case {'bandpass', 'band-pass', 'band pass'} + f = mkbandpass(f, plo); + case {'bandreject', 'band-reject', 'band reject'} + f = mkbandreject(f, plo); + otherwise + error('### unknown standard filter type in miir constructor.'); + end + + if isempty(pl.find('name')) + pl.pset('name', type); + end + + % Add history + f.addHistory(ii, pl, [], []); + + % Set object properties + f.setObjectProperties(pl); + +end % function f = miirFromStandardType(type, pli, version, algoname) + +