%  Show the velocity profiles in a movie
%
%  Version 2.0, 3/9-98, JAJ
%  Version 3.0, 18/9-2017, JAJ
%     Updated with units on axis and new font sizes
%  Version 3.1, 17/9-2018, JAJ
%     Small changes in font sizes

%  Find the scaling for the velocity

y= -1:deltaR:1;
vmin=min(min(profiles));
vmax=max(max(profiles));

%  Generate a suitable color table

Np=round(vmax/(vmax-vmin)*128);
positive=hot(Np);
negative=cool(128-Np);
colormap([negative; positive(Np:-1:1,:)]);

%  Generate the movie

time_index=1;
axes(hp1);
for time=0:deltaT:2*pi/omega_0
    index=1;
    for x=-1:deltaR:1
        velo_dist(:,index)=profiles(floor(sqrt(x.^2 + y.^2)/deltaR + 1.5),time_index);
        index=index+1;
    end
    place= time/(omega_0/(2*pi))*360;
    surf(y*R*1000,y*R*1000,velo_dist)
    xlabel('Distance [mm]', 'FontSize', 18)
    ylabel('Distance [mm]', 'FontSize', 18)
    title(artery_name, 'FontSize', 18)

    set(gca,'FontSize', 16)
    axis([[-R R -R R]*1000 vmin vmax])
    caxis([vmin vmax])
    zlabel('Velocity [m/s]', 'FontSize', 18)
    drawnow
    if (time==0)
        M = moviein(floor(omega_0/(2*pi*deltaT)+0.5));
    end
    M(:,time_index)=getframe;
    time_index=time_index+1;
end

%  Play the movie in real-time 20 times

movie(M,20,20*62/60);
