Thread Subject: Creating a movie with varying time steps

Subject: Creating a movie with varying time steps

From: Alexander Erlich

Date: 11 Jun, 2009 13:56:40

Message: 1 of 5

Hi there,

suppose I have a solution of a differential equation which I would
like to visualize with surf. The numerical solution tells me exactly
when to plot the object in which coordinates. Now, I would like to
create a movie out of these surf plots. I cannot use getframe, as it
does not enable me to consider the varying time steps. Is there
another way to do that?

Thanks in advance!

Alexander

Subject: Creating a movie with varying time steps

From: Steven Lord

Date: 11 Jun, 2009 14:14:57

Message: 2 of 5


"Alexander Erlich" <alexander.erlich@gmail.com> wrote in message
news:54d79ffd-aeb6-4244-ac04-445c12c94c06@z7g2000vbh.googlegroups.com...
> Hi there,
>
> suppose I have a solution of a differential equation which I would
> like to visualize with surf. The numerical solution tells me exactly
> when to plot the object in which coordinates. Now, I would like to
> create a movie out of these surf plots. I cannot use getframe, as it
> does not enable me to consider the varying time steps. Is there
> another way to do that?

Solve the system of ODEs to generate a solution struct array (using the "sol
= ..." syntax described in the help rather than the "[t, y] = ..." syntax.)
Once you have the solution struct, use DEVAL to evaluate the solution at
equally-spaced time steps. Then create the movie from the surfaces created
by the equally-timestep-spaced data.

--
Steve Lord
slord@mathworks.com

Subject: Creating a movie with varying time steps

From: Alexander

Date: 11 Jun, 2009 18:11:17

Message: 3 of 5

Thank you Steve,

I will try that. But I still have a question: Suppose I had equally-
spaced time steps. Getframe won't know how long one time step is, will
it? It might play the movie much faster than it really (=as given by
the solution of the ODE) is, or slower, probably depending on my
computer. If I'm right with that problem, what could I do?

Alexander

On Jun 11, 4:14 pm, "Steven Lord" <sl...@mathworks.com> wrote:
> "Alexander Erlich" <alexander.erl...@gmail.com> wrote in message
>
> news:54d79ffd-aeb6-4244-ac04-445c12c94c06@z7g2000vbh.googlegroups.com...
>
> > Hi there,
>
> > suppose I have a solution of a differential equation which I would
> > like to visualize with surf. The numerical solution tells me exactly
> > when to plot the object in which coordinates. Now, I would like to
> > create a movie out of these surf plots. I cannot use getframe, as it
> > does not enable me to consider the varying time steps. Is there
> > another way to do that?
>
> Solve the system of ODEs to generate a solution struct array (using the "sol
> = ..." syntax described in the help rather than the "[t, y] = ..." syntax.)
> Once you have the solution struct, use DEVAL to evaluate the solution at
> equally-spaced time steps.  Then create the movie from the surfaces created
> by the equally-timestep-spaced data.
>
> --
> Steve Lord
> sl...@mathworks.com

Subject: Creating a movie with varying time steps

From: Steven Lord

Date: 11 Jun, 2009 21:35:03

Message: 4 of 5


"Alexander" <alexander.erlich@gmail.com> wrote in message
news:749aa82c-1702-4c71-b5c2-209488908cee@h11g2000yqb.googlegroups.com...
> Thank you Steve,
>
> I will try that. But I still have a question: Suppose I had equally-
> spaced time steps. Getframe won't know how long one time step is, will
> it? It might play the movie much faster than it really (=as given by
> the solution of the ODE) is, or slower, probably depending on my
> computer. If I'm right with that problem, what could I do?

You're correct that GETFRAME doesn't know how long one time step is.
Technically, MOVIE and AVIFILE don't know how long one time step is either.
But both MOVIE and AVIFILE know how many frames to show per second, and
that's just as good, isn't it?

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/movie.html

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/avifile.html

--
Steve Lord
slord@mathworks.com

Subject: Creating a movie with varying time steps

From: Alexander

Date: 12 Jun, 2009 14:31:40

Message: 5 of 5

Thanks a lot Steve,

it makes sense :-)

It would have taken me ages to figure this out myself, I didn't know
about deval! Now, with a movie of let's say 20fps, I can use deval to
obtain intervals of 1/20th of a second and render the movie! This
method will probably enable me to make my computer render a movie of
60s for three hours or so, hopefully making it both correct and
optically refined!

Thanks!

Alexander

On Jun 11, 11:35 pm, "Steven Lord" <sl...@mathworks.com> wrote:
> "Alexander" <alexander.erl...@gmail.com> wrote in message
>
> news:749aa82c-1702-4c71-b5c2-209488908cee@h11g2000yqb.googlegroups.com...
>
> > Thank you Steve,
>
> > I will try that. But I still have a question: Suppose I had equally-
> > spaced time steps. Getframe won't know how long one time step is, will
> > it? It might play the movie much faster than it really (=as given by
> > the solution of the ODE) is, or slower, probably depending on my
> > computer. If I'm right with that problem, what could I do?
>
> You're correct that GETFRAME doesn't know how long one time step is.
> Technically, MOVIE and AVIFILE don't know how long one time step is either.
> But both MOVIE and AVIFILE know how many frames to show per second, and
> that's just as good, isn't it?
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/movie.html
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/avifile.html
>
> --
> Steve Lord
> sl...@mathworks.com

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
movie Sprinceana 22 Jun, 2009 07:02:54
create a movie Sprinceana 22 Jun, 2009 07:02:54
matlab movie Sprinceana 22 Jun, 2009 07:02:54
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com