Mercurial > repos > public > sbplib
comparison +noname/animate.m @ 112:b7f40a0c6476
Added ability to see every timestep.
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Wed, 09 Dec 2015 15:49:25 +0100 |
| parents | 14bf01b7a068 |
| children | 1035c190e8de |
comparison
equal
deleted
inserted
replaced
| 111:0e66299592cc | 112:b7f40a0c6476 |
|---|---|
| 14 if time_modifier < 0 | 14 if time_modifier < 0 |
| 15 do_pause = true; | 15 do_pause = true; |
| 16 time_modifier = -time_modifier; | 16 time_modifier = -time_modifier; |
| 17 else | 17 else |
| 18 do_pause = false; | 18 do_pause = false; |
| 19 end | |
| 20 | |
| 21 if isinf(time_modifier) | |
| 22 do_step = true; | |
| 23 else | |
| 24 do_step = false; | |
| 19 end | 25 end |
| 20 | 26 |
| 21 makemovies = ~strcmp(dirname,''); | 27 makemovies = ~strcmp(dirname,''); |
| 22 if makemovies | 28 if makemovies |
| 23 dirname = ['mov/' dirname]; | 29 dirname = ['mov/' dirname]; |
| 72 | 78 |
| 73 fprintf('Using time step k = %.6f\n',ts.k); | 79 fprintf('Using time step k = %.6f\n',ts.k); |
| 74 fprintf('System size: %d\n',size(discretization)); | 80 fprintf('System size: %d\n',size(discretization)); |
| 75 % waitforbuttonpress | 81 % waitforbuttonpress |
| 76 | 82 |
| 77 anim.animate(@G, Tstart, Tend, time_modifier); | 83 |
| 84 if ~do_step | |
| 85 anim.animate(@G, Tstart, Tend, time_modifier); | |
| 86 else | |
| 87 while true | |
| 88 ts.step(); | |
| 89 sol = discretization.getTimeSnapshot(ts); | |
| 90 update(sol); | |
| 91 drawnow | |
| 92 | |
| 93 if do_pause | |
| 94 pause | |
| 95 end | |
| 96 end | |
| 97 end | |
| 78 | 98 |
| 79 % str = util.replace_string(str,''); | 99 % str = util.replace_string(str,''); |
| 80 | 100 |
| 81 % if makemovies | 101 % if makemovies |
| 82 % fprintf('Generating movies...\n') | 102 % fprintf('Generating movies...\n') |
