% coalbin_N.m
%
% P. Flandrin

m = 30; 
r = 100; 
tin = .1; 
fs = 5e3;
[t,x,f] = bhchirp(m,r,tin,fs);
ph = 2*pi*cumsum(f)/3000;
N = 3*length(ph)/4;
R = linspace(.7,0,N);

figure(1)
clf

pause

for k = 1:N
	plot(R(k)*cos(ph(k)),R(k)*sin(ph(k)),'.','MarkerSize',80)
	hold on
	plot(-R(k)*cos(ph(k)),-R(k)*sin(ph(k)),'.','MarkerSize',80)
	hold off
	axis('square')
	axis([-1 1 -1 1])
	set(gca,'XTick',[],'YTick',[])
	title('coalescing binary','FontSize',16)
	pause(.5)
end

NN = N/64;
M = linspace(80,400,NN);
for k = 1:NN
	plot(0,0,'.','MarkerSize',(M(k)))
	axis('square')
	axis([-1 1 -1 1])
	set(gca,'XTick',[],'YTick',[])
	title('coalescing binary','FontSize',16)
	pause(.5)
end
M = linspace(400,0,2*NN);
for k = 1:2*NN
	plot(0,0,'.','MarkerSize',(M(k)))
	axis('square')
	axis([-1 1 -1 1])
	set(gca,'XTick',[],'YTick',[])
	title('coalescing binary','FontSize',16)
	pause(.5)
end
