% WV2S_movie.m
%
% P. Flandrin
clf
pause

load batrich.mat
sig = hilbert(x-mean(x));

Nbin = 128; % nombre de bins fréquentiels
dt = 2; % écart (en échantillons) entre dates de calcul

t = 1:dt:length(sig);

M = moviein(12);

[wv,T,F] = tfrwv(sig,t,Nbin);
imagesc(flipud(wv+abs(wv)));
colormap(jet)
set(gca,'YTick',[]);set(gca,'XTick',[])
M(:,1) = getframe;
M(:,2) = getframe;

[spwv,T,F] = tfrspwv(sig,t,Nbin,window(3,'Kaiser'),window(255,'Kaiser'));
imagesc(flipud(spwv+abs(spwv)));
colormap(jet)
set(gca,'YTick',[]);set(gca,'XTick',[])
M(:,3) = getframe;
M(:,4) = getframe;

[spwv,T,F] = tfrspwv(sig,t,Nbin,window(7,'Kaiser'),window(127,'Kaiser'));
imagesc(flipud(spwv+abs(spwv)));
colormap(jet)
set(gca,'YTick',[]);set(gca,'XTick',[])
M(:,5) = getframe;
M(:,6) = getframe;

[spwv,T,F] = tfrspwv(sig,t,Nbin,window(15,'Kaiser'),window(91,'Kaiser'));
imagesc(flipud(spwv+abs(spwv)));
colormap(jet)
set(gca,'YTick',[]);set(gca,'XTick',[])
M(:,7) = getframe;
M(:,8) = getframe;

[spwv,T,F] = tfrspwv(sig,t,Nbin,window(31,'Kaiser'),window(63,'Kaiser'));
imagesc(flipud(spwv+abs(spwv)));
colormap(jet)
set(gca,'YTick',[]);set(gca,'XTick',[])
M(:,9) = getframe;
M(:,10) = getframe;

[s,T,F] = tfrsp(sig,t,2*Nbin,window(63,'Kaiser'));
imagesc(flipud(s(1:128,:)));
colormap(jet)
set(gca,'YTick',[]);set(gca,'XTick',[])
M(:,11) = getframe;
M(:,12) = getframe;

movie(M,-15)
