0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
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
0023 ii = ao.getInfo('ao', 'From Frequency-series Function');
0024
0025
0026 ii.setMversion([VERSION '-->' ii.mversion]);
0027
0028
0029 pl = combine(pli, ii.plists);
0030 f = find(pl, 'f');
0031 randn_state = find(pl, 'rand_state');
0032
0033
0034
0035 if ~isempty(randn_state)
0036 randn('state',randn_state);
0037 else
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
0059 fcn = find(pl, 'fsfcn');
0060
0061
0062 y = eval([fcn ';']);
0063
0064 fs = fsdata(f,y);
0065 fs.setXunits('Hz');
0066
0067
0068 a.data = fs;
0069
0070 a.addHistory(ii, pl, [], []);
0071
0072 end
0073