Home > classes > @ao > fromPolyval.m

fromPolyval

PURPOSE ^

FROMPOLYVAL Construct a time-series ao from polynomial coefficients

SYNOPSIS ^

function a = fromPolyval(a, pli)

DESCRIPTION ^

 FROMPOLYVAL Construct a time-series ao from polynomial coefficients
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 FUNCTION:    fromPolyval

 DESCRIPTION: Construct a time-series ao from polynomial coefficients

 CALL:        a = fromPolyval(a, vals)

 PARAMETER:
              pl:       plist containing 'polyval', 'Nsecs', 'fs', or 't'

 HISTORY:     07-05-2007 Hewitson
              Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % FROMPOLYVAL Construct a time-series ao from polynomial coefficients
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % FUNCTION:    fromPolyval
0005 %
0006 % DESCRIPTION: Construct a time-series ao from polynomial coefficients
0007 %
0008 % CALL:        a = fromPolyval(a, vals)
0009 %
0010 % PARAMETER:
0011 %              pl:       plist containing 'polyval', 'Nsecs', 'fs', or 't'
0012 %
0013 % HISTORY:     07-05-2007 Hewitson
0014 %              Creation
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 
0018 function a = fromPolyval(a, pli)
0019 
0020   VERSION = '$Id: fromPolyval.m,v 1.9 2008/09/04 13:37:14 ingo Exp $';
0021   % get AO info
0022   ii = ao.getInfo('ao', 'From Polynomial');
0023 
0024   % Set the method version string in the minfo object
0025   ii.setMversion([VERSION '-->' ii.mversion]);
0026 
0027   % Add default values
0028   pl = combine(pli, ii.plists);
0029 
0030   coeffs = find(pl, 'polyval');
0031   Nsecs  = find(pl, 'Nsecs');
0032   fs     = find(pl, 'fs');
0033   t      = find(pl, 't');
0034 
0035   % Check t vector
0036   if isempty(t)
0037     if isempty(Nsecs) || isempty(fs)
0038       error('### Please provide either ''Nsecs'' and ''fs'', or ''t'' for polyval constructor.');
0039     end
0040     t = linspace(0, Nsecs - 1/fs, Nsecs*fs);
0041   end
0042 
0043   y = polyval(coeffs,t);
0044 
0045   % Make a tsdata object
0046   ts = tsdata(t, y);
0047   ts.setXunits('s');
0048   ts.setYunits('V');
0049 
0050   % Make an analysis object
0051   a.data  = ts;
0052   a.addHistory(ii, pl, [], []);
0053 
0054 end
0055

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003