Mercurial > repos > public > sbplib
annotate +anim/setup_time_quantity_plot.m @ 1031:2ef20d00b386 feature/advectionRV
For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 17 Jan 2019 10:25:06 +0100 |
parents | 2ffa82fb5172 |
children |
rev | line source |
---|---|
0 | 1 function [update_data, plot_handles] = setup_time_quantity_plot(yfun) |
2 default_arg('yfun',@(y)y); | |
3 | |
69
f87003695677
Moved drawno out of plot update functions for huge performance boost.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
4 if isa(yfun,'function_handle') |
f87003695677
Moved drawno out of plot update functions for huge performance boost.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
5 yfun = {yfun}; |
f87003695677
Moved drawno out of plot update functions for huge performance boost.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
6 end |
f87003695677
Moved drawno out of plot update functions for huge performance boost.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
7 |
0 | 8 t = []; |
9 for i = 1:length(yfun) | |
72
942cb3c53a47
Simplified implementation of time quantity plot.
Jonatan Werpers <jonatan@werpers.com>
parents:
70
diff
changeset
|
10 plot_handles(i) = animatedline(); |
0 | 11 end |
12 | |
13 axis_handle = gca; | |
14 | |
15 function update(t_now,varargin) | |
16 if ishandle(axis_handle) | |
72
942cb3c53a47
Simplified implementation of time quantity plot.
Jonatan Werpers <jonatan@werpers.com>
parents:
70
diff
changeset
|
17 % t = [t t_now]; |
0 | 18 for j = 1:length(yfun) |
771
2ffa82fb5172
Make setup_time_quantity_plot() accept sparse vectors
Jonatan Werpers <jonatan@werpers.com>
parents:
94
diff
changeset
|
19 addpoints(plot_handles(j),t_now,full(yfun{j}(varargin{:}))); |
0 | 20 end |
70
243c558dc3ae
Made end of animated quantity plot nicer.
Jonatan Werpers <jonatan@werpers.com>
parents:
69
diff
changeset
|
21 |
72
942cb3c53a47
Simplified implementation of time quantity plot.
Jonatan Werpers <jonatan@werpers.com>
parents:
70
diff
changeset
|
22 [t,~] = getpoints(plot_handles(1)); |
942cb3c53a47
Simplified implementation of time quantity plot.
Jonatan Werpers <jonatan@werpers.com>
parents:
70
diff
changeset
|
23 if t(1) < t(end) |
74
d0df12c03aac
Added missing axis_handle reference.
Jonatan Werpers <jonatan@werpers.com>
parents:
72
diff
changeset
|
24 xlim(axis_handle, [t(1) t(end)]); |
70
243c558dc3ae
Made end of animated quantity plot nicer.
Jonatan Werpers <jonatan@werpers.com>
parents:
69
diff
changeset
|
25 end |
0 | 26 end |
27 end | |
28 update_data = @update; | |
29 end |