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

%  unifrnd
%  rand('seed', 12345);
%  rand("state", 1234);

% subplot(2,2,1) %A

fXA = logspace(1.2,4.2,100);
COUNT = 1:1:100; COUNT2 = -5:0.1:4.9;
f_L = 750; % Hz
r_OUT  = 1./(1 + exp((2.*fXA-4.*f_L)./f_L));
fX100 =  logspace(1.2,4.2,100);
r_100 = 1./(1 + exp((2.*fX100-4.*f_L)./f_L));
r_SIGMA = 0.1;
% r_RND = r_OUT/2; % plot(x,-2*(x/k).*exp(-x.^2/k))
INFLAT = -2*(COUNT2/1) .*exp(-COUNT2 .^2/1);

rand('state',3141592); % octave/ Matlab OK
r_DATA_0 = rand(size(COUNT2));
r_DATA_1 = (+1) .* r_DATA_0 .* r_SIGMA .* INFLAT;
   %%% *sign(COUNTER-600) ;
%% r_DATA_2 = 0.9 .* r_OUT + r_DATA_1;
%% r_DATA_2 = 0 + 0.45 .* r_OUT(COUNT) + r_DATA_1;
 r_DATA_2 = 0 + 0.9 .* r_100 + r_DATA_1;
 % 1./(1 + exp((2.*fXA-4.*f_L)./f_L));
hold on
semilogx(fXA, r_OUT, 'r'); 
%semilogx([20 100*COUNT(1,1:100) -5000], [0.6 r_DATA_2(1,1:100)], 'b+-.');
semilogx(fXA, r_DATA_2(1,1:100).*r_OUT, 'k+-.');
%semilogx([20 80 200],[0.58 0.81 r_DATA_2(1,1)], 'g+-.');
semilogx([20 80 200 fXA(4:100)-COUNT(4:100)*10], ...
   [0.58 0.81 0.88 .9*r_OUT(4:100)], 'b');
grid on
xlabel('Sound Frequency [Hz]');
ylabel('Vector Strength');
% axis([10^1 10^4 -0.2 1.2])
axis([20 10^4 -0.1 1.1])

print('-depsc2', 'FM1V1.eps')
unix('eps2pdfpm FM1V1')
