% Cohen class Time-Frequency Distribution (in the Time-Frequency plane) of 
% a signal that consists of 
% (1) 2 slighly different Gabor atoms whose internal frequencies progressively increase, 
% (2) A Dirac, 
% (3) A sinusoid, 
% (4) A noise that increases for each repeated sequence. (23')


for q=0.2:0.05:17.65;
   
    % N°1    
    if q<=3.65
         t=-10:0.05:12;ta=-10:0.05:10;b1=0;a1=1.5;b3=-5;b2=6;oo=3.5;
         pp=0:0.1:10; dd=sin(pi.*pp)./3;
         ooo=zeros(1,65);
gt3=(exp((-((ta-b3)).^2)).*(exp(i.*(q.*(oo).*pi).*((ta-b3)))));
g2=(exp((-((t-b2)).^2)).*(exp(i.*(q.*(5.5).*pi).*((t-b2))))); %5.5
dir=1;
s=gt3(20:170);
s1=g2(246:439);
J=[s dir ooo dd s1];
po=real(J);
sig=po';   

    % N°2
    elseif   q>3.65 & q<=7.10
q1=q-3.45;
t=-10:0.05:12; ta=-10:0.05:10; b1=0;a1=1.5;b3=-5;b2=6;oo=3.5;
pp=0:0.1:10; dd=sin(pi.*pp)./3;
 ooo=zeros(1,65);
 gt3=(exp((-((ta-b3)).^2)).*(exp(i.*(q1.*(oo).*pi).*((ta-b3)))));
g2=(exp((-((t-b2)).^2)).*(exp(i.*(q1.*(5.5).*pi).*((t-b2))))); %5.5
dir=1;
s=gt3(20:170);
s1=g2(246:439);
J=[s dir ooo dd s1];
noise=(rand(512,1))./5;
J1=noise'+J;
po=real(J1);
sig=po';        

% N°3  
    elseif   7.10<q & q<=10.55
q2=q-7;
t=-10:0.05:12; ta=-10:0.05:10; b1=0;a1=1.5;b3=-5;b2=6;oo=3.5;
pp=0:0.1:10; dd=sin(pi.*pp)./3;
 ooo=zeros(1,65);
gt3=(exp((-((ta-b3)).^2)).*(exp(i.*(q2.*(oo).*pi).*((ta-b3)))));
g2=(exp((-((t-b2)).^2)).*(exp(i.*(q2.*(5.5).*pi).*((t-b2))))); %5.5
dir=1;
s=gt3(20:170);
s1=g2(246:439);
J=[s dir ooo dd s1];
noise=(rand(512,1))./3;
J1=noise'+J;
po=real(J1);
sig=po';    

% N°4  
    elseif   10.55<q & q<=14.00
q3=q-10.45;
t=-10:0.05:12; ta=-10:0.05:10; b1=0;a1=1.5;b3=-5;b2=6;oo=3.5;
pp=0:0.1:10; dd=sin(pi.*pp)./3;
 ooo=zeros(1,65);
gt3=(exp((-((ta-b3)).^2)).*(exp(i.*(q3.*(oo).*pi).*((ta-b3)))));
g2=(exp((-((t-b2)).^2)).*(exp(i.*(q3.*(5.5).*pi).*((t-b2))))); %5.5
dir=1;
s=gt3(20:170);
s1=g2(246:439);
J=[s dir ooo dd s1];
noise=(rand(512,1))./2;
J1=noise'+J;
po=real(J1);
sig=po';    

     % N°5 
     else  14<q & q<=17.65;               
q4=q-13.95;
t=-10:0.05:12; ta=-10:0.05:10; b1=0;a1=1.5;b3=-5;b2=6;oo=3.5;
pp=0:0.1:10; dd=sin(pi.*pp)./3;
ooo=zeros(1,65);
gt3=(exp((-((ta-b3)).^2)).*(exp(i.*(q4.*(oo).*pi).*((ta-b3)))));
g2=(exp((-((t-b2)).^2)).*(exp(i.*(q4.*(5.5).*pi).*((t-b2))))); %5.5
dir=1;
s=gt3(20:170);
s1=g2(246:439);
J=[s dir ooo dd s1];
%K=1+(q./5);
noise=rand(512,1);
J1=noise'+J;
po=real(J1);
sig=po';                
  
    end       
pause(0.00000000000001); 
r1=subplot(211);
l1=plot(po,'b','markersize',5); 
axis([0 512 min(po) max(po)]);
ylabel('Signal'); 
r2=subplot(212);
cwd =CohenDist(sig,512);
set(r1,'position',[0.1 0.77 0.85 0.2]);
set(r2,'position',[0.1 0.1 0.85 0.66]);
   
end


% "Complex and Chaotic Nonlinear Dynamics. 
% Advances in Economics and Finance, 
% Mathematics and Statistics" 
% T.Vialar, Springer 2009
% Copyright(c).
