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.11 2008/09/07 11:09:50 hewitson Exp $';
0020
0021
0022 ii = ao.getInfo('ao', 'From Pzmodel');
0023
0024
0025 ii.setMversion([VERSION '-->' ii.mversion]);
0026
0027
0028 pl = combine(pli, ii.plists);
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) || nsecs == 0
0037 error('### Please provide ''Nsecs'' for pzmodel constructor.');
0038 end
0039 if isempty(fs) || fs == 0
0040 error('### Please provide ''fs'' for pzmodel constructor.');
0041 end
0042
0043
0044
0045
0046 disp(' - Filter coefficients are calculated from input pzmodel.');
0047 [num, den] = ao.ngconv(pzm);
0048
0049
0050 toolboxinfo = ver('symbolic');
0051
0052 if isempty(toolboxinfo)
0053 disp('the time series is calculated without the symbolic math toolbox')
0054 disp(' - Matrices are calculated from evaluated denominator coefficients.');
0055 [Tinit, Tprop, E] = ao.ngsetup(den, fs);
0056 else
0057 disp('the time series is calculated using the symbolic math toolbox')
0058 disp(' - Matrices are calculated from evaluated denominator coefficients.');
0059 if isempty(ndigits)
0060 ndigits = 32;
0061 warning('### set number of digits to 32!')
0062 end
0063 [Tinit, Tprop, E] = ao.ngsetup_vpa(den, fs, ndigits);
0064 end
0065
0066
0067 disp(' - Since there is no given state vector it will be calculated.');
0068
0069
0070 y = ao.nginit(Tinit);
0071
0072
0073 [x, yo] = ao.ngprop(Tprop, E, num, y, fs*nsecs);
0074
0075
0076 t = x*pzm.gain;
0077 a.data = tsdata(t,fs);
0078 a.setName(sprintf('noisegen(%s)', pzm.name), 'internal');
0079
0080
0081 a.setXunits('s', 'internal');
0082 a.setYunits('V', 'internal');
0083
0084
0085 a.addHistory(ii, pl, [], pzm.hist);
0086
0087 end
0088
0089