comparison +noname/animate.m @ 114:1035c190e8de

noname.animate: Updated documentation. Fixed bug with start time. Added pause before starting.
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 14 Dec 2015 18:57:02 +0100
parents b7f40a0c6476
children 6ec2248b83c4
comparison
equal deleted inserted replaced
113:a4e1608ae980 114:1035c190e8de
1 % animate(dirname,discretization,Tend, time_modifier,time_method) 1 % hand = animate(discretization, time_modifier, Tend, dirname, opt)
2 % 2 %
3 % Example: 3 % Example:
4 % animate('',discr,tend) 4 % animate(discr,timemodifier,tend)
5 % animate('my_mov',discr,tend,time_mod,time_method) 5 % animate(discr,1, [tstart tend],'my_mov', opt)
6 6
7 function hand = animate(discretization, time_modifier, Tend, dirname, opt) 7 function hand = animate(discretization, time_modifier, Tend, dirname, opt)
8 default_arg('time_modifier',1); 8 default_arg('time_modifier',1);
9 default_arg('Tend', Inf); 9 default_arg('Tend', Inf);
10 default_arg('dirname',''); 10 default_arg('dirname','');
44 fprintf('Evolving to starting time: '); 44 fprintf('Evolving to starting time: ');
45 ts.evolve(Tstart,'true'); 45 ts.evolve(Tstart,'true');
46 fprintf(' - Done\n'); 46 fprintf(' - Done\n');
47 start_solution = discretization.getTimeSnapshot(ts); 47 start_solution = discretization.getTimeSnapshot(ts);
48 else 48 else
49 Tstart = 0;
50 start_solution = discretization.getTimeSnapshot(0); 49 start_solution = discretization.getTimeSnapshot(0);
50 Tstart = start_solution.t;
51 end 51 end
52 52
53 [update, figure_handle] = discretization.setupPlot('animation'); 53 [update, figure_handle] = discretization.setupPlot('animation');
54 if makemovies 54 if makemovies
55 save_frame = anim.setup_fig_mov(figure_handle,dirname); 55 save_frame = anim.setup_fig_mov(figure_handle,dirname);
80 fprintf('System size: %d\n',size(discretization)); 80 fprintf('System size: %d\n',size(discretization));
81 % waitforbuttonpress 81 % waitforbuttonpress
82 82
83 83
84 if ~do_step 84 if ~do_step
85 pause
85 anim.animate(@G, Tstart, Tend, time_modifier); 86 anim.animate(@G, Tstart, Tend, time_modifier);
86 else 87 else
87 while true 88 while true
88 ts.step(); 89 ts.step();
89 sol = discretization.getTimeSnapshot(ts); 90 sol = discretization.getTimeSnapshot(ts);