% makes a logon in TF space
%
% also shows a sheart is same as a shearf for Gaussian

npts = 32768;
%M = 200;  % for colour use higher value
%N = 200;
M = 150;  % for 3 in fig; 50pts/inch
N = 150;
%M = 100;
%N = 100;
%npts = 1000;

vertmag = 16;

vt = 1/6;  % variance in time;
           % temporal support is always to be 3 sigma either side
dt = sqrt(pi) * vt;  % temporal ``extent''

dis = rand('dist');  % remember state
rand('normal')

t = linspace(-.5*(npts-1)/npts,.5*(npts-1)/npts,npts);
L2cst = 1/sqrt(sqrt(pi));   % const out front for Gaussian with unit L2 norm
g = L2cst/vt * exp(-1/2 * (t/vt).^2);  % gaussian window in time
plot(real(g))
title('gaussina func')
pause
G = fftshift(fft(g));
G = fftshift(fft(g));
plot(abs(G))
title('spectrum of unchirped')
pause

%g = undsamlef(g);
%g = [zeros(1,length(g)/2) g zeros(1,length(g)/2)];
%gc = freqshift(g,-.015,.015); % chirped (shear in frequency)
Gc = freqshift(G,.5,-.5);
plot(abs(Gc));
title('spectrum of chirpled')
pause
gc = ifft(fftshift(Gc));
plot(real(gc));
title('real part of time domain sig, with generalized dalay (Fchirp)')
pause

GG = tf(gc(:),M,N,vertmag); % vertical axis magnif factor
GG = GG((vertmag-1)*M/2+1 : (vertmag+1)*M/2 , :);

%mat2eps_tf(abs(GG))
%!mv deleteme.eps logontf_mag.eps
%mat2eps_tf(real(GG))
%!mv deleteme.eps logontf_real.eps
%mat2eps_tf(imag(GG))
%!mv deleteme.eps logontf_imag.eps

%mat2cps(GG) % cmpx color

rand(dis) % restore to original state

