diff m-toolbox/classes/@mfir/fromA.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/fromA.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,54 @@
+% Construct an mfir from coefficients
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FUNCTION:    fromA
+%
+% DESCRIPTION: Construct an mfir from coefficients
+%
+% CALL:        f = fromA(f, pli)
+%
+% PARAMETER:   pli:       Parameter list object
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function f = fromA(f, pli)
+  
+  VERSION = '$Id: fromA.m,v 1.17 2011/08/15 11:36:50 hewitson Exp $';
+  
+  ii = mfir.getInfo('mfir', 'From A');
+  % Set the method version string in the minfo object
+  ii.setMversion([VERSION '-->' ii.mversion]);
+  
+  % Add default values
+  pl = applyDefaults(ii.plists, pli);
+  
+  a  = find(pl, 'a');
+  fs = find(pl, 'fs');
+  
+  % Checking the coefficients are listed in rows
+  if size(a,1)~=1
+    a = a';
+  end
+  
+  % Zero pad coefficients to avoid zero length history
+  if numel(a) <= 1
+    a = [a 0];
+  end
+  
+  f.fs      = fs;
+  f.a       = a;
+  f.gd      = (f.ntaps-1)/2;
+  f.histout = zeros(1,f.ntaps-1); % initialise output history
+  
+  % Override some properties of the input plist
+  if isempty(pl.find('name'))
+    pl.pset('name', 'A');
+  end
+  
+  % Add history
+  f.addHistory(ii, pl, [], []);
+  
+  % Set object properties
+  f.setObjectProperties(pl);
+  
+end % End fromA