diff m-toolbox/classes/@ao/fromXYFcn.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/@ao/fromXYFcn.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,51 @@
+% FROMXYFCN Construct an ao from a function f(x) string
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FUNCTION:    fromXYfcn
+%
+% DESCRIPTION: Construct an ao from a function f(x) string
+%
+% CALL:        a = fromXYfcn(pl)
+%
+% PARAMETER:   pl: Parameter list object
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+function a = fromXYFcn(a, pli)
+  
+  VERSION = '$Id: fromXYFcn.m,v 1.9 2011/08/16 06:06:17 hewitson Exp $';
+  
+  % get AO info
+  ii = ao.getInfo('ao', 'From XY Function');
+  
+  % Set the method version string in the minfo object
+  ii.setMversion([VERSION '-->' ii.mversion]);
+  
+  % Add default values
+  pl = applyDefaults(ii.plists, pli);
+  pl.getSetRandState();
+  
+  % Get parameters
+  fcn = find(pl, 'xyfcn');
+  x   = find(pl, 'X');
+  
+  % Make data
+  ts = xydata(x,eval([fcn ';']));
+  
+  % Make an analysis object
+  a.data = ts;
+  
+  % Add history
+  a.addHistory(ii, pl, [], []);
+  
+  % Set xunits
+  a.setXunits(pl.find('xunits'));
+  
+  % Set yunits
+  a.setYunits(pl.find('yunits'));
+  
+  % Set object properties from the plist
+  a.setObjectProperties(pl);
+  
+end
+
+