0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 function a = fromPzmodel(a, pli)
0018
0019 VERSION = '$Id: fromPzmodel.m,v 1.9 2008/08/01 13:19:42 ingo Exp $';
0020
0021
0022 ii = ao.getInfo('ao', 'From Pzmodel');
0023
0024
0025 ii.setMversion([VERSION '-->' ii.mversion]);
0026
0027
0028 pl = combine(pli, ao.getDefaultPlist('From Pzmodel'));
0029
0030 pzm = find(pl, 'pzmodel');
0031 nsecs = find(pl, 'Nsecs');
0032 fs = find(pl, 'fs');
0033 ndigits = find(pl, 'ndigits');
0034
0035
0036 if isempty(nsecs) || isempty(fs)
0037 error('### Please provide either ''Nsecs'' and ''fs'' for pzmodel constructor.');
0038 end
0039
0040
0041
0042
0043 disp(' - Filter coefficients are calculated from input pzmodel.');
0044 [num, den] = ao.ngconv(pzm);
0045
0046
0047 toolboxinfo = ver('symbolic');
0048
0049 if isempty(toolboxinfo)
0050 disp('the time series is calculated without the symbolic math toolbox')
0051 disp(' - Matrices are calculated from evaluated denominator coefficients.');
0052 [Tinit, Tprop, E] = ao.ngsetup(den, fs);
0053 else
0054 disp('the time series is calculated using the symbolic math toolbox')
0055 disp(' - Matrices are calculated from evaluated denominator coefficients.');
0056 if isempty(ndigits)
0057 ndigits = 32;
0058 warning('### set number of digits to 32!')
0059 end
0060 [Tinit, Tprop, E] = ao.ngsetup_vpa(den, fs, ndigits);
0061 end
0062
0063
0064 disp(' - Since there is no given state vector it will be calculated.');
0065
0066
0067 y = ao.nginit(Tinit);
0068
0069
0070 [x, yo] = ao.ngprop(Tprop, E, num, y, fs*nsecs);
0071
0072
0073 t = x*pzm.gain;
0074 a.data = tsdata(t,fs);
0075 a.setName(sprintf('noisegen(%s)', pzm.name), 'internal');
0076
0077
0078 a.setXunits('s', 'internal');
0079 a.setYunits('V', 'internal');
0080
0081
0082 a.addHistory(ii, pli, [], pzm.hist);
0083
0084 end
0085
0086