mc

%%
% make ao of desired response
apl = plist('filename', 'mdc2_1_tf11_np.dat', 'type', 'fsdata')
a = ao(apl);

% now make LISO fit file

% start with a guess pzmodel

z0(1) = pz(1e-6);
zl(1) = pz(1e-07);
zu(1) = pz(1e-05);

p0(1) = pz(400e-9);
pl(1) = pz(1e-07);
pu(1) = pz(1e-05);

p0(2) = pz(1e-6);
pl(2) = pz(1e-07);
pu(2) = pz(1e-05);

p0(3) = pz(30e-6);
pl(3) = pz(1e-06);
pu(3) = pz(1e-4);

z0(2) = pz(50e-6);
zl(2) = pz(1e-06);
zu(2) = pz(1e-4);

z0(3) = pz(50e-6);
zl(3) = pz(1e-06);
zu(3) = pz(1e-4);

z0(4) = pz(50e-6);
zl(4) = pz(1e-06);
zu(4) = pz(1e-4);

z0(5) = pz(50e-6);
zl(5) = pz(1e-06);
zu(5) = pz(1e-4);

p0(4) = pz(7e-3);
pl(4) = pz(1e-4);
pu(4) = pz(1e-1);

p0(5) = pz(7e-3);
pl(5) = pz(1e-4);
pu(5) = pz(1e-1);

p0(6) = pz(40e-3);
pl(6) = pz(1e-4);
pu(6) = pz(1);

p0(7) = pz(40e-3);
pl(7) = pz(1e-4);
pu(7) = pz(1);

z0(6) = pz(0.5);
zl(6) = pz(0.01);
zu(6) = pz(1);

p0(8) = pz(0.1);
pl(8) = pz(0.01);
pu(8) = pz(10);

z0(6) = pz(0.5);
zl(6) = pz(0.01);
zu(6) = pz(1);


pzm0 = pzmodel(1e-10, p0, z0);
pzml = pzmodel(1e-12, pl, zl);
pzmu = pzmodel(1e-8, pu, zu);

resp(pzm0,pzml,pzmu)


%%
  fpl = plist('PZM0', pzm0, 'PZML', pzml, 'PZMU', pzmu, 'delay', [0 1 10], 'f1', 1e-4, 'f2', 1, 'nf', 100);

pzmfit = lisovfit(a, fpl);

%%

f0   = resp(pzm0);
rfit = resp(pzmfit);

iplot(f0, rfit)

