% sum_lin_N.m
%
% P. Flandrin

clf
pause

N = 16; % nombre total de logons

Ns = 256;
Na = Ns/12;
sigc = atoms(Ns,[Na,.05,Na,1]);
wv = tfrwv(sigc,1:Ns,Ns);

for k = 1:N-1
	signew = atoms(Ns,[floor(Na + k*(Ns-2*Na)/(N-1)),.05+k*.4/(N-1),Na,1]);
	sigtot = sigc + signew.*exp(i*pi*(floor(Na + k*(Ns-2*Na)/(N-1)).*(.05+k*.4/(N-1))));
	wv = wv + tfrwv(signew,1:Ns,Ns);
	wvtot = tfrwv(sigtot,1:Ns,Ns);
	subplot(1,2,1)
	imagesc(flipud(wv+abs(wv)));
	axis('square')
	title(['somme des WV (N = ',num2str(k+1),')'])
    colormap(jet)
    set(gca,'YTick',[]);set(gca,'XTick',[])
	subplot(1,2,2)
	imagesc(flipud(wvtot+abs(wvtot)));
	axis('square')
	title(['WV de la somme (N = ',num2str(k+1),')'])
    colormap(jet)
    set(gca,'YTick',[]);set(gca,'XTick',[])
	sigc = sigtot;
	pause%(.3)
end


