% Input 1
dt=0.02;
df=0.02;
t=-6:dt:6;
f=-4:df:4;
x=exp(-pi*t.^2);
B=0.5;
% Input 2
% dt=0.05;
% df=0.05;
% t1=[-3:dt:10-dt];
% t2=[10:dt:20-dt];
% t3=[20:dt:33];
% t=[t1,t2,t3];
% f=[-5:df:5];
% x=[cos(pi*t1),cos(3*pi*t2),cos(2*pi*t3)];
% B=1;
tic
y=STFT2(x,t,f,B);    % Method 2, FFT
toc
tic
[y1,to1]=STFT(x,t,f,B);   % Method 3, recursive
toc
subplot(1,2,1)
image(t,f,abs(y)/max(max(abs(y)))*256)
colormap(gray(256))
title('B=0.5, x=exp(-pi*t^2), Method 2')
set(gca,'Ydir','normal')
subplot(1,2,2)
image(to1,f,abs(y1)/max(max(abs(y1)))*256)
colormap(gray(256))
title('B=0.5, x=exp(-pi*t^2), Method 3')
set(gca,'Ydir','normal')


