% co robit?:
% 1) pochopit, co je  zobrazene na spektrograme a skalograme
% 2) Nastavovat rozne signaly a wavelety - porovnavat vysledky so spektrogramami
% 3) nastavovat rozne mierky pri spektrograme
%

%SETUP wavelet
% wavelet types:db1,db2,...,db20,mexh,morl,gaus1-8,...
wav_type='gaus1'

%generate input signals
% chirp-like signal
 max=10
 t = 0:max/256:max;              
 mychirp = sin(t.*t)+cos(5*t.*t);       
 mychirp2 = sin(t.*t);       

% combined signal
twopi=2*3.14159
t = 0:twopi/(64-1):twopi;              

my_combi1=zeros(1,256);
my_combi1(1:64)=sin(7*t);
my_combi1(65:128)=sin(15*t);
my_combi1(129:192)=sin(1*t);
my_combi1(193:256)=sin(7*t);

my_combi2=zeros(1,256);
my_combi2(1:64)=2*sin(7*t).*sin(15*t);
my_combi2(65:128)=sin(15*t);
my_combi2(129:192)=sin(1*t)+sin(15*t);;
my_combi2(193:256)=sin(7*t);

% chirp-like signal
 my_break1=zeros(1,256);
 my_break1(1:128)=ones(1,128);
 
 my_break2=zeros(1,256);
 my_break2(1:128)=1:128
 my_break2(100)=0;
 my_break2(101)=0;
 my_break2(50)=128;
 my_break2(51)=128;

 %set actual inputs
 
 %input1=mychirp
 %input2=mychirp2
 input1=my_combi1;
 %input2=my_combi2
 %input1=my_break1
 input2=my_break2;

 % plot input1
 subplot(2,4,1);
 plot(input1);
 set(gca,'Xlim',[0 256])
 title('Vstupný signál 1');
 
 % plot SPECTROGRAM for input1
 subplot(2,4,2)
    [b,f,t]=specgram(input1,256,256,hanning(50),48);
    imagesc(t,f,abs(b)), title('Spektrogram 1');
    
% plot SWT for input 1
    subplot(2,4,3)
    ccfs = cwt(input1,1:0.1:32,wav_type,'head'); 
    title('|SWT koeficienty|') 
    ylabel('mierka')
     
 % plot input2
 subplot(2,4,5);
 plot(input2);
 set(gca,'Xlim',[0 256])
 title('Vstupný signál 2');
 
 % plot SPECTROGRAM for input2
 subplot(2,4,6)
    [b,f,t]=specgram(input2,256,256,hanning(50),48);
    imagesc(t,f,abs(b))
    title('Spektrogram 2');
    
% plot SWT for input 2
    subplot(2,4,7)
    ccfs = cwt(input2,1:0.1:32,wav_type,'head'); 
    title('|SWT koeficienty|') 
    ylabel('mierka')
    colormap(jet(64)); 
    

