diff m-toolbox/classes/@mfir/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/@mfir/fromStandard.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,54 @@
+% Construct an mfir from a standard types
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FUNCTION:    fromStandard
+%
+% DESCRIPTION: Construct an mfir 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.15 2011/08/15 11:42:53 hewitson Exp $';
+  
+  ii = mfir.getInfo('mfir', '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 = mfir.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 mfir 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 = mfirFromStandardType(type, pli, version, algoname)