Ns = 128; % nombre d'Žchantillons du signal
Nfft = Ns/2; % nombre de bins frŽquentiels
Na = Ns/12;
sig = fmsin(Ns,0.1,0.4,Ns/2);
noise = hilbert(randn(Ns,1));
yb = real(sigmerge(sig,noise,0)) ;
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(1)

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