0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 function a = fromFSfcn(a, pli)
0018
0019 VERSION = '$Id: fromFSfcn.m,v 1.10 2008/08/22 14:11:33 ingo Exp $';
0020
0021 ii = ao.getInfo('ao', 'From Frequency-series Function');
0022
0023
0024 ii.setMversion([VERSION '-->' ii.mversion]);
0025
0026
0027 pl = combine(pli, ao.getDefaultPlist('From Frequency-series Function'));
0028 f = find(pl, 'f');
0029 randn_state = find(pl, 'rand_state');
0030
0031
0032
0033 if ~isempty(randn_state)
0034 randn('state',randn_state);
0035 else
0036 randn_state = randn('state');
0037 pli.append('rand_state', randn_state);
0038 end
0039
0040 if isempty(f)
0041 disp('--- generating f')
0042 f1 = find(pl, 'f1');
0043 f2 = find(pl, 'f2');
0044 nf = find(pl, 'nf');
0045 scale = find(pl, 'scale');
0046 switch scale
0047 case 'log'
0048 f = logspace(log10(f1), log10(f2), nf);
0049 case 'lin'
0050 f = linspace(f1, f2, nf);
0051 otherwise
0052 error('### Unknown frequency scale specified');
0053 end
0054 end
0055
0056
0057 fcn = find(pl, 'fsfcn');
0058
0059
0060 y = eval([fcn ';']);
0061
0062 fs = fsdata(f,y);
0063 fs.setXunits('Hz');
0064
0065
0066 a.data = fs;
0067
0068 a.addHistory(ii, pli, [], []);
0069
0070 end
0071