mc;

% Make a TF

fs = 10;
nsecs = 100000;
in = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm'));

pzm = pzmodel(0.123, 0.001, 0.4);
filt = miir(pzm, plist('fs', fs));
filt.setIunits('m');
filt.setOunits('V');

out = filter(in, filt) + ao(plist('tsfcn', '0.0001*randn(size(t))', 'fs', fs, 'nsecs', nsecs));

tf = tfe(in, out, plist('order', 2, 'nfft', fs*nsecs))

%% Make fitting models

pzm0 = pzmodel(0.1,  0.001, 0.1);
pzml = pzmodel(0.01, 0.0001, 0.01);
pzmu = pzmodel(1,    0.1, 1);

pzmfit = lisovfit(tf(1,2), plist('PZM0', pzm0, 'pzml', pzml, 'pzmu', pzmu, 'delay', [0 0.01 100]))

%% Plot

iplot(tf(1,2), resp(pzmfit, plist('f', tf(1,2))) )


