GUI that plots dynamical system flow fields (and more) with sliders for adjusting parameters.
sysViewer Dynamical system graphical interface.
h = sysViewer(oPar, cPar, fcn, typ) builds a GUI for viewing the
effects of parameter changes on a one or twodimensional dynamical
system.
oPar and cPar are twocolumn cell arrays that define the order
parameter and control parameter(s), respectively. The first column
contains parameter names (strings to be typeset in latex). The second
column contains 1x2 vectors of parameter's range. This vector defines
plot axes limits for the order parameter and slider limits for the
control parameters.
The system is defined by the function handle fcn. For onedimensional
systems, this should be a function with two inputs and one output. The
first input is system state, which will be a scalar in a one
dimensional system. The second input is a vector of control parameter
values. The output of fcn can be either the rate of change of the order
parameter (in which case fcn is the flow equation), or the system
potential (in which case fcn is the potential function). Which function
is supplied can be indicated by the last input typ, one of the strings
'flow' or 'potential'. If typ is empty or omitted, 'flow' is the
default.
For twodimensional systems defined with a flow, fcn should be a cell
array containing two function handles, each outputting the rate of
change along one dimension. Each function should take three inputs; the
first two are scalar values of the order parameters, the third is a
vector of control parameters. For twodimensional systems defined with
a potential, fcn should take inputs as above and output a scalar.
The output h is a struct containing handles to the graphics objects in
the GUI. Intended only for advanced tweaking or troubleshooting.
sysViewer(..., defs) initializes the parameter sliders with the default
values in vector defs.
sysViewer(..., 'vectorize') speeds up computation for functions that
cannot be evaluated with a vector. In fact, any number of trailing
arguments will be passed to chebfun. See CHEBFUN for more options
(CHEBFUN2 and CHEBFUN2V for twodimensional options).

Examples:

Onedimensional

sysViewer({'\phi' [pi pi]}, ...
{'b/a' [0 1]; '\Delta\omega' [2 2]}, ...
@(x,c) c(2)*xcos(x)c(1)*cos(2*x), ...
'potential');
sysViewer({'\phi' [pi pi]}, ...
{'b/a' [0 1]; '\Delta\omega' [2 2]}, ...
@(x,c) c(2)sin(x)2*c(1)*sin(2*x), ...
'flow');
sysViewer({'\phi' [pi pi]}, ...
{'b/a' [0 1]; '\Delta\omega' [2 2]; 'c' [0 .5]; 'd' [0 .5]}, ...
@(x,c) c(2)*xcos(x)c(1)*cos(2*x)+c(3)*sin(x)+c(4)*sin(2*x), ...
'potential');
sysViewer({'\phi' [pi pi]}, ...
{'b/a' [0 1]; '\Delta\omega' [2 2]; 'c' [0 .5]; 'd' [0 .5]}, ...
@(x,c) c(2)sin(x)2*c(1)*sin(2*x)+c(3)*cos(x)+2*c(4)*cos(2*x), ...
'flow');

Twodimensional

sysViewer('x' [5 5]; '\dot{x}' [5 5]}, ...
[{'\alpha'; '\beta'; '\delta'} repmat({[5 5]}, 3, 1)], ...
{@(x,dx,r) dx, @(x,dx,r) r(1).*x.^3  r(2).*x  r(3).*dx}, ...
'flow')

Dependencies (if missing, user will be prompted to download and install):
GUI Layout Toolbox
sliderPanel
uibutton
Chebfun:
 Stable version (onedimensional systems only)
 Alpha release (required for viewing twodimensional systems)
(as of March 14 2013)
1.2  Added an acknowledgement I had left out. 

1.1  Minor change in a user message. 
Inspired by: Require FEX package, uibutton: GUI pushbuttons with better labels, sliderPanel, Chebfun V4  old version; please download current version instead, GUI Layout Toolbox
Henry Harrison (view profile)
Adam, thanks for the feedback.
Yep, it was working through Strogatz (and my professor's terrible Matlab visualizations) that inspired me to write this.
I had removed the toolbars at one point but I added them back in for some reason. Don't remember what my reason was, if I can remember which tool I needed maybe I'll delete the rest but leave that.
I'll definitely go with OOP next time, especially after learning OOP design principles for Python. It definitely looks easier for Matlab GUIs.
Thanks for the addlistener tip! That always bugged me.
Adam Filion (view profile)
Cool tool, wish I had this back in grad school when I was working through Nonlinear Dynamics and Chaos by Strogatz. I have a few suggestions.
 Personally, I find it much easier to build and maintain apps in MATLAB as handle classes rather than through purely functional programming. You can find an article introducing the idea and why it should be used here:
http://www.mathworks.com/company/newsletters/articles/writingappsinmatlab.html
 Remove any menus or toolbar buttons you don’t want users playing with. There’s no reason to use things like the 3D rotate tool with this app. For example, you can remove all of them with:
menus = findall(gcf,'Type','uimenu');
delete(menus)
toolbar = findall(gcf,'Type','uitoolbar');
delete(toolbar)
 Try using addlistener to create continuous feedback when dragging sliders, something like the following has worked well for me.
myslider = uicontrol('Style', 'slider', 'Callback', @sliderCB);
addlistener(myslider,'ContinuousValueChange',@sliderCB);
 There's a small typo in two dimension example, missing a {
Henry Harrison (view profile)
I'm open for suggestions for useful features.