Home > classes > @ao > fromFSfcn.m

fromFSfcn

PURPOSE ^

FROMFSFCN Construct an ao from a fs-function string

SYNOPSIS ^

function a = fromFSfcn(a, pli)

DESCRIPTION ^

 FROMFSFCN Construct an ao from a fs-function string
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 FUNCTION:    fromFSfcn

 DESCRIPTION: Construct an ao from a fs-function string

 CALL:        a = fromFSfcn(a, pl)

 PARAMETER:
              pl:       Parameter list object

 HISTORY:     07-05-2007 Hewitson
              Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % FROMFSFCN Construct an ao from a fs-function string
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % FUNCTION:    fromFSfcn
0005 %
0006 % DESCRIPTION: Construct an ao from a fs-function string
0007 %
0008 % CALL:        a = fromFSfcn(a, pl)
0009 %
0010 % PARAMETER:
0011 %              pl:       Parameter list object
0012 %
0013 % HISTORY:     07-05-2007 Hewitson
0014 %              Creation
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 function a = fromFSfcn(a, pli)
0018   
0019   import utils.const.*
0020 
0021   VERSION = '$Id: fromFSfcn.m,v 1.12 2008/09/07 18:08:37 hewitson Exp $';
0022   % get AO info
0023   ii = ao.getInfo('ao', 'From Frequency-series Function');
0024 
0025   % Set the method version string in the minfo object
0026   ii.setMversion([VERSION '-->' ii.mversion]);
0027 
0028   % Add default values
0029   pl          = combine(pli, ii.plists);
0030   f           = find(pl, 'f');
0031   randn_state = find(pl, 'rand_state');
0032 
0033   % If the randn state is in the parameter list then set the randn function to
0034   % this sate
0035   if ~isempty(randn_state)
0036     randn('state',randn_state);
0037   else % Store the state of the random function in the parameter list
0038     randn_state = randn('state');
0039     pl.append('rand_state', randn_state);
0040   end
0041 
0042   if isempty(f)
0043     utils.helper.msg(msg.PROC2, 'generating f vector');
0044     f1 = find(pl, 'f1');
0045     f2 = find(pl, 'f2');
0046     nf = find(pl, 'nf');
0047     scale = find(pl, 'scale');
0048     switch scale
0049       case 'log'
0050         f = logspace(log10(f1), log10(f2), nf);
0051       case 'lin'
0052         f = linspace(f1, f2, nf);
0053       otherwise
0054         error('### Unknown frequency scale specified');
0055     end
0056   end
0057 
0058   % Get the function
0059   fcn = find(pl, 'fsfcn');
0060 
0061   % make y data
0062   y = eval([fcn ';']);
0063 
0064   fs = fsdata(f,y);
0065   fs.setXunits('Hz');
0066 
0067   % Make an analysis object
0068   a.data  = fs;
0069   % Add history
0070   a.addHistory(ii, pl, [], []);
0071 
0072 end
0073

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