load Finv_s012_s015.octavemat

%variously smoothed Finv (e.g. lambda=0, 100, 1000, etc..
Finv0=Finv0(2:255); % endpoints not valid...
Finv100=Finv100(2:255); % endpoints not valid...
Finv200=Finv200(2:255); % endpoints not valid...
Finv1000=Finv1000(2:255); % endpoints not valid...
Finv4000=Finv4000(2:255); % endpoints not valid...

Uncertainty=diff(Finv0); Certainty=1../Uncertainty;
c0=interp_odd_to(Certainty,3); % interp in 3 points not just 1, since ends gone
c0=real(c0);

Uncertainty=diff(Finv100); Certainty=1../Uncertainty;
c100=interp_odd_to(Certainty,3); c100=real(c100);

Uncertainty=diff(Finv1000); Certainty=1../Uncertainty;
c1000=interp_odd_to(Certainty,3); c1000=real(c1000);

% normalize:
c0=c0/max(c0);
c100=c100/max(c100);
c1000=c1000/max(c1000);

%tossed out the endpoints, therefore need to restore these:
Finv0=[Finv0(1);Finv0;Finv0(254)]; % restore endpoints
Finv100=[Finv100(1);Finv100;Finv100(254)]; % restore endpoints
Finv1000=[Finv1000(1);Finv1000;Finv1000(254)]; % restore endpoints

x=0:255;
gset terminal x11
gset nokey
%gset nolinestyle
xlabel('pixel integer')
ylabel('relative certainty')
axis([0 255 0 1.05])
%plot(x,c0,':',x,c100,'--',x,c1000,'-.');
%plot(x,c0,x,c100,'+',x,c1000,'x')
plot(x,c0,'1',x,c100,'2',x,c1000,'4') %linetype 1solid 2longdas 3shortdas 4dot
%plot(x,[c0 c100 c1000])

gset terminal postscript eps 30 # show it like it is, 35 fits nicely
system('rm fig_Finv_s012_s015_certainties.eps');
gset output 'fig_Finv_s012_s015_certainties.eps';
replot

gset terminal x11
gset nokey
ylabel('pixel integer')
xlabel('Quantity of light, Q = log(q)')
axis([-10 0 0 255])
%%grid
plot(Finv0,x,'1',Finv100,x,'2',Finv1000,x,'4')
gset terminal postscript eps 30 # show it like it is, 35 fits nicely
system('rm fig_Finv_s012_s015.eps');
gset output 'fig_Finv_s012_s015.eps';
replot

gset terminal x11

