Mercurial > repos > public > sbplib
comparison +anim/setup_1d_plot.m @ 142:484b48e95c83
Removed ylim from setup1dPlot added some comments and fixed timestepper paramters.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 29 Feb 2016 15:00:52 +0100 |
parents | a4e1608ae980 |
children | df83c8095326 |
comparison
equal
deleted
inserted
replaced
141:cb2b12246b7e | 142:484b48e95c83 |
---|---|
7 % | 7 % |
8 % update_data(t,varargin) - Function to update plot data. All varargin will | 8 % update_data(t,varargin) - Function to update plot data. All varargin will |
9 % be passed to functions in yfun. | 9 % be passed to functions in yfun. |
10 % plot_handles - Array of plot_handles. One for each yfun. | 10 % plot_handles - Array of plot_handles. One for each yfun. |
11 % axis_handle - Handle to the axis plotted to. | 11 % axis_handle - Handle to the axis plotted to. |
12 function [update_data, plot_handles, axis_handle] = setup_1d_plot(x,y_lim,yfun) | 12 function [update_data, plot_handles, axis_handle] = setup_1d_plot(x,yfun) |
13 default_arg('yfun',{@(y)y}); | 13 default_arg('yfun',{@(y)y}); |
14 | 14 |
15 if isa(yfun,'function_handle') | 15 if isa(yfun,'function_handle') |
16 yfun = {yfun}; | 16 yfun = {yfun}; |
17 end | 17 end |
26 | 26 |
27 xlabel('x') | 27 xlabel('x') |
28 ylabel('y') | 28 ylabel('y') |
29 xlim([x(1) x(end)]); | 29 xlim([x(1) x(end)]); |
30 | 30 |
31 if ~isempty(y_lim) | |
32 ylim(y_lim); | |
33 end | |
34 | |
35 function update(t,varargin) | 31 function update(t,varargin) |
36 if ishandle(figure_handle) && ishandle(axis_handle) | 32 if ishandle(figure_handle) && ishandle(axis_handle) |
37 for i = 1:length(yfun) | 33 for i = 1:length(yfun) |
38 set(plot_handles(i),'YData',yfun{i}(varargin{:})); | 34 set(plot_handles(i),'YData',yfun{i}(varargin{:})); |
39 end | 35 end |