% Emacs mode header: -*-Octave-*- source. %
%%  #! /usr/bin/octave -qf 

%subplot(2,2,4)%D1234567890

fXD = logspace(1.2,4.2,1000);
fXD10 = logspace(2,3.5,10);
fYD2 = 0.00001*(fXD - 1000).*(fXD - 1000)+6; % + 8; =quadratic fit
  fYD3 = 10^(-8)*fYD2.*fXD + 0.05*log(fXD) + 0.2; % +0.2+0.05*log(fXD)
% fYD4 = [125, 55; 250, 30; 500, 16; 1000, 11; 1250, 24]; %old
  fYD4 = [125, 51; 250, 30; 500, 16; 1000, 11; 2000, 24]; %new
  fYDU =  100*(log10(fXD) - 3).^2 + 15;
  fYDL =  100*(log10(fXD) - 3).^2 + 10;
  fYDSin = 20*(sin(fXD/100))+ 20 + 5;
   %  fYDSin = 100*(sin(fXD) - 3).^2 + 20;
   % semilogx(fXD, fYD2, 'k',140, 13.333,'o');

  semilogx(fXD, fYD2+7.33-3.333, 'b-')
% deleted: [140 1000], 13.333*ones(1,2),'ko'); %'r'/k
% lower: blue
hold on
fYD10 = .00005*(fXD10-1000).*(fXD10-1000)+ 15;
semilogx(fXD10, fYD10, 'gs','LineWidth',2)
% upper bound/ red; 'go'/k)
fSD10 = spline(fXD10, fYD10, fXD);
semilogx(fXD, fSD10, 'r-'); %,'LineWidth',2)
semilogx(fYD4(:,1),fYD4(:,2),'ks-'); %'b'/k

semilogx(fXD,fYDU,'c.')
semilogx(fXD,fYDSin,'g.')
% simulated: black

title ("Fig.: FM2BV1.m");
grid on
xlabel('Sound Frequency [Hz]');
ylabel('ITD [{\mu}s]');
% axis([10^1 2*10^3 0 30])
axis([20^1 10^4 0 60])
print('-depsc2', 'FM2BV1.eps') % deps/ depsc
unix('eps2pdfpm FM2BV1')
% E O F
