Make a Movie with StreamSlice in Matlab

277 Views Asked by At

I am with a problem to create a movie with streamslice function in Matlab from a velocity field. In that code I show how I do with streamline and quiver movie. It way runs well. But, when I use streamslice the data not are refresh, and the plots curvs are plotting over another. Anybody have already done streamslice video?

Code for Velocity Field with Streamline and Quiver

for k = 1:numb_time_step

    xx{k}=x;
    yy{k}=y;

    quiver(xx{k},yy{k},u_final{k},v_final{k},10)

   startx =0:0.05:1;
   starty =0:0.05:1;
   streamline(xx{k},yy{k},u_final{k},v_final{k},startx,starty);
   view(2),axis([0 1 0 1])

  title({'Velocity Field';['Time(\itt) = ',num2str(time(k))]})
  xlabel('coordenada x')
  ylabel('coordenada y')

   grid on
   drawnow; 
   refreshdata(h);

  M(k)=getframe(gcf); % leaving gcf out crops the frame in the movie.

 end

movie2avi(M,'Streamlines.avi');

Code for StreamSlice

for k = 1:numb_time_step

   xx{k}=x;
   yy{k}=y;

h=streamslice(xx{k},yy{k},u_final{k},v_final{k});
view(2),axis([0 1 0 1])

title('Stream Lines of Vector Field')
xlabel('Coordenada x')
ylabel('Coordenada y')
grid on

 grid on
 drawnow; 
 refreshdata(h);

 M(k)=getframe; % leaving gcf out crops the frame in the movie.

end

movie2avi(M,'StreamSlices.avi');
0

There are 0 best solutions below