Mercurial > repos > public > sbplib
annotate +anim/setup_time_quantity_plot.m @ 87:0a29a60e0b21
In Curve: Rearranged for speed. arc_length_fun is now a property of Curve. If it is not supplied, it is computed via the derivative and spline fitting. Switching to the arc length parameterization is much faster now. The new stuff can be tested with testArcLength.m (which should be deleted after that).
author | Martin Almquist <martin.almquist@it.uu.se> |
---|---|
date | Sun, 29 Nov 2015 22:23:09 +0100 |
parents | d0df12c03aac |
children | a38c243991d0 |
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 legend() | |
15 | |
16 | |
17 function update(t_now,varargin) | |
18 if ishandle(axis_handle) | |
72
942cb3c53a47
Simplified implementation of time quantity plot.
Jonatan Werpers <jonatan@werpers.com>
parents:
70
diff
changeset
|
19 % t = [t t_now]; |
0 | 20 for j = 1:length(yfun) |
72
942cb3c53a47
Simplified implementation of time quantity plot.
Jonatan Werpers <jonatan@werpers.com>
parents:
70
diff
changeset
|
21 addpoints(plot_handles(j),t_now,yfun{j}(varargin{:})); |
0 | 22 end |
70
243c558dc3ae
Made end of animated quantity plot nicer.
Jonatan Werpers <jonatan@werpers.com>
parents:
69
diff
changeset
|
23 |
72
942cb3c53a47
Simplified implementation of time quantity plot.
Jonatan Werpers <jonatan@werpers.com>
parents:
70
diff
changeset
|
24 [t,~] = getpoints(plot_handles(1)); |
942cb3c53a47
Simplified implementation of time quantity plot.
Jonatan Werpers <jonatan@werpers.com>
parents:
70
diff
changeset
|
25 if t(1) < t(end) |
74
d0df12c03aac
Added missing axis_handle reference.
Jonatan Werpers <jonatan@werpers.com>
parents:
72
diff
changeset
|
26 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
|
27 end |
0 | 28 end |
29 end | |
30 update_data = @update; | |
31 end |