Ns = 256; % nombre d'Žchantillons du signal
Nfft = Ns; % nombre de bins frŽquentiels
Na = 2*fix(Ns/8)+1;
sig = fmconst(Ns,0.1,fix(Ns/3)).*amgauss(Ns,Ns/4,Na);
noise = hilbert(randn(Ns,1));
yb = real(sigmerge(sig,noise,-10)) ;

Ssig = tfrsp(sig,1:Ns,Nfft,tftb_window(Na,'Gauss'),1) ;
Snoise = tfrsp(noise,1:Ns,Nfft,tftb_window(Na,'Gauss'),1) ;
Syb = tfrsp(yb,1:Ns,Nfft,tftb_window(Na,'Gauss'),1) ;

figure(1)
subplot(311)
imagesc(flipud(Ssig(1:Nfft/2,:)))
subplot(312)
imagesc(flipud(Snoise(1:Nfft/2,:)))
subplot(313)
imagesc(flipud(Syb(1:Nfft/2,:)))

M = 6 ;
Nh = Ns/4-1;%2*fix(Nx/10)-1 ; % length of Hermite functions

% computation

[S,RS,HAT,tt] = tfrrsp_hmt(yb,1:Ns,Nfft,Nh,M,5) ;
% w = tfrwv(hilbert(yb),t,Nfft/2) ;
Sm = [] ; RSm = [] ;
for m = 1:M ;
    [Sm(:,:,m),RSm(:,:,m)] = mean_hmt(S(:,:,1:m),RS(:,:,1:m),HAT,1) ;
end

%[s,rs,HAT] = tfrrsp(yb,1:8:Ny,Nfft,H,1) ;
dyn = 20 ; t = 1:Ns ;%(Nh+1)/2:Ny-(Nh+1)/2 ;
figure(2)

for m = 1:M
    subplot(M,2,1+2*(m-1))
    imageTF(Sm(1:Nfft/2,t,m),dyn,1,0)
    title(['spectro. (M = ',int2str(m),')'])
    xlabel(' ') ; ylabel(' ')
    subplot(M,2,2+2*(m-1))
    imageTF(RSm(1:Nfft/2,t,m),dyn,1,0)
    title(['reass. spectro. (M = ',int2str(m),')'])
    xlabel(' ') ; ylabel(' ')
end