% figure to demonstrate the Wyckoff principle of 3 film layers

% means (first moments)
m1=-1;
m2=0;
m3=1;

s=1; % stddev

x=linspace(-3,3,200);
y1=(x-m1)./s;
y2=(x-m2)./s;
y3=(x-m3)./s;

% Gaussians
g1=1/sqrt(2*pi*s^2) * exp(-y1.^2);
g2=1/sqrt(2*pi*s^2) * exp(-y2.^2);
g3=1/sqrt(2*pi*s^2) * exp(-y3.^2);
disp(sprintf('Area under each curve should be 1 but is really %g',sum(g2)))

% error functions (erf)
e1=cumsum(g1);
e2=cumsum(g2);
e3=cumsum(g3);

% least sensitive film is dotted (fine grain like Ektar 25)
% medium sensitive film is dashed (medium grain like Gold 100)
% most sensitive film is solid line (coarse grain like Gold 400)

subplot(212)
plot(x,g1,'--',x,g2,':',x,g3,'-')
title('Gaussians')
subplot(211)
plot(x,e1,'--',x,e2,':',x,e3,'-')
title('Wyckoff film response        erf')

shift=max(e1);   % should be 1???
shift=shift*.55; %??? seems to work ok; just try this
figure
plot(x,e1-shift,'--',x,e2,':',x,e3+shift,'-')
title('New processing of Wyckoff film (did Wyckoff do this)?')

