Skip to main content
edited tags
Link
LCarvalho
  • 9.3k
  • 5
  • 40
  • 97
Routine clean-up
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

What in Mathematica is equivalent to GetFrame in Matlab vs "WHAT" in Mathematica?

Hello I am going to develop an unsteady diffusion calculation in Mathematica, because. Because it is unsteady, I would like to visualize the solution each time step (or in some time steps). My MATLAB skills are much better than Mathematica, so II am going to give the example from there. I looked at some of the posts about that, but they were for small number of time steps like 10, or saving each plot and creating a movie. But in MATLAB I can do

surf(x,z,U_sol)
F=getframe;

xx and zz are the position vectors and U_solU_sol is the solution matrix. GetFrameGetFrame simply preserves frame but not the plot, so it looks like a continuous plotsplotting, like a movie.

On top of thatIn Matlab, you can do something like this to save the movie directly. This is before time steps

fid=figure;
pos=get(fid,'position');
writerObj=VideoWriter('sol.avi');
writerObj.FrameRate=10;
open(writerObj);

and inside the time loop

 PLOT...
 frame=getframe(gcf);
 writeVideo(writerObj,frame)

and at the end of the time loop.

 close (writerObj)

and you will have the movie file without dealing with each frame. There should be some equivalent version in Mathematica. Thank you for the help.

and Happy New Year :)

Erdem

GetFrame in Matlab vs "WHAT" in Mathematica

Hello I am going to develop an unsteady diffusion calculation in Mathematica, because it is unsteady I would like to visualize the solution each time step (or in some time steps). My MATLAB skills are much better than Mathematica so I am going to give the example from there. I looked some of the posts about that but they were for small number of time steps like 10, or saving each plot and creating a movie. But in MATLAB I can do

surf(x,z,U_sol)
F=getframe;

x and z are the position vectors and U_sol is the solution matrix. GetFrame simply preserves frame but not the plot so it looks like a continuous plots like a movie.

On top of that you can do something like this to save the movie directly. This is before time steps

fid=figure;
pos=get(fid,'position');
writerObj=VideoWriter('sol.avi');
writerObj.FrameRate=10;
open(writerObj);

and inside the time loop

 PLOT...
 frame=getframe(gcf);
 writeVideo(writerObj,frame)

and at the end of the time loop.

 close (writerObj)

and you will have the movie file without dealing with each frame. There should be some equivalent version in Mathematica. Thank you for the help.

and Happy New Year :)

Erdem

What in Mathematica is equivalent to GetFrame in Matlab?

I am going to develop an unsteady diffusion calculation in Mathematica. Because it is unsteady, I would like to visualize the solution each time step (or in some time steps). My MATLAB skills are much better than Mathematica, so I am going to give the example from there. I looked at some of the posts about that, but they were for small number of time steps like 10, or saving each plot and creating a movie. But in MATLAB I can do

surf(x,z,U_sol)
F=getframe;

x and z are the position vectors and U_sol is the solution matrix. GetFrame simply preserves frame but not the plot, so it looks like a continuous plotting, like a movie.

In Matlab, you can do something like this to save the movie directly. This is before time steps

fid=figure;
pos=get(fid,'position');
writerObj=VideoWriter('sol.avi');
writerObj.FrameRate=10;
open(writerObj);

and inside the time loop

 PLOT...
 frame=getframe(gcf);
 writeVideo(writerObj,frame)

and at the end of the time loop.

 close (writerObj)

and you will have the movie file without dealing with each frame. There should be some equivalent version in Mathematica.

edited tags
Link
Source Link
Erdem
  • 889
  • 4
  • 11
Loading