Plotting graphs into a movie

Given the following code, there is a variable "I" that is set to 0. How can I increase "I" to 2 while making it a movie. Example: Increasing "I" at 0.01 increments and as "I" increases the graph will change and that change can be shown as a movie.
function dot=fitz(t,v);
dot=zeros(2,1);
I=0;
dot(2)=0.08*(v(1)+0.7-0.8*v(2));
dot(1)=v(1)-(v(1)^3)/3-v(2)+I;
[t,v]=ode45('fitz',[0 200],[0,0]);
plot(v(:,1),v(:,2),'-');

Answers (1)

Walter Roberson
Walter Roberson on 6 Dec 2013
After the plot(), add a short pause(), and then getframe(). If you aren't generating a lot of frames, then store them all and use videowriter afterwards. But if needed for storage, use videowriter as you go.

1 Comment

How would I increase variable "I" so I can make different plots? I would like the program to increase I by 0.01 and plot every graph one after another on the same window like a movie. I get the pause and getframe part, but what to I put into the program to increase "I" while the program runs?

Sign in to comment.

Categories

Asked:

on 6 Dec 2013

Commented:

on 6 Dec 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!