%  Show a set of moving scatterers as a dynamic movie
%
%  Version 1.1, 9/9-98, JAJ
%  Version 1.2, 7/9-05, JAJ: Printing of seconds improved
%  Version 3.0, 18/9-2017, JAJ
%     Improved version with better display and distances on

%  Set initial parameters

N=20;              %  Number of scatterers
x=zeros(N,1)+0.1;  %  Set initial position
y=(N:-1:1)*deltaR;

ph=plot(x,(1-y)*R*1000,'o','LineWidth',2);
set(gca,'FontSize',16)
%ph = line(y*R*1000,pro,'o','color','b','LineWidth',2);
axis([0 3 0 R*1000])
xlabel('Placement in vessel [m]')
ylabel('Radial distance [mm]')

t=0;
for i=0:7
    time_index=1;
    for time=0:deltaT:2*pi/omega_0
        
        %  Find the velocity for the scatterer
        
        v=profiles(1:N,time_index);
        
        %  Propagate the scatterers to the new position
        
        x = x + v*deltaT;
        t = t + deltaT;
        
        %  Display the new position
        
        set (ph, 'XData', x, 'Ydata', (1-y)*R*1000);
        drawnow
        time_index=time_index+1;
        
        %  Make a slight delay
        
        tic;
        while (toc < deltaT)
            j=sin(pi);
        end
        %title (['Time is ',num2str(t),' sec.'])
        title (['Time is ',sprintf('%6.2f',t),' sec.'])
    end
end


