plots - Maple Programming Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Graphics : Packages : plots : plots/odeplot





2-D or 3-D plot of output from dsolve


Calling Sequence




Calling Sequence

odeplot(dsn, vars, range, options)




output from a call to dsolve( ... , numeric)



(optional list) axes and functions to plot



(optional) range; range of the independent variable



(optional) equations that specify plot options; see plot/options and plot3d/option



The odeplot function plots or animates one or more solution curves (either 2-D or 3-D) obtained from the output (dsn) of a call to dsolve/numeric.


Note: If you are using the output=piecewise option with dsolve/numeric, you should use the plot function to plot or animate your solution.


The ordering of the coordinates is given by vars. If no coordinates are given, then it is assumed that a plot of the first dependent variable as a function of the independent variable is desired (that is, the first two coordinates of the solution).


Significantly more flexibility is available in the specification of the coordinates.


The coordinates can be functions of the independent variable, or any dependent variable and derivative values that are part of the dsolve/numeric solution. For example, for a second-order problem in yx, you could specify a plot of yx versus yx2+ⅆⅆxyx2 with yx,yx2+ⅆⅆxyx2.


Multiple curves can be plotted by specifying a nested list format. For example, x,yx,x,ⅆⅆxyx displays the dependent variable and its derivative as a function of x on the same plot.


Curve-specific options can be specified for each curve (for plots with multiple curves) by including them in the desired variable list after the plot variables. Allowed options are color, linestyle, style, symbol, symbolsize, and thickness. (These are described in plot/options and plot3d/option.) For example, the plot described by the nested list above can be displayed with yx in blue dots, and ⅆⅆxyx as a red line of thickness 2 with the argument [[x,y(x),color=blue,style=point],[x,diff(y(x),x),color=red,thickness=2]].


The range argument defines the range of the independent variable to produce the plot, and must evaluate to real numbers. If not supplied, the range is determined as follows:


If the dsolve/numeric output is not of a procedure type (that is, it is in the form of a matrix or Matrix), then the values present in the matrix are used directly for the plot.


If the problem is a boundary value problem (BVP), then the plot is produced for the entire solution region.


If the problem is a initial value problem (IVP), and was created with a range (rkf45 and rosenbrock only), then that range is used for the plot.


If the problem is a IVP, _Env_smart_dsolve_numeric is set to true, and a prior call was made to the procedure, the plot is produced from the initial point to the point used in the prior call.


Finally, if none of the above conditions are met, then the plot is produced for the range x0-10..x0+10, where x0 is the initial point for the IVP.


If the default numerical IVP solvers rkf45 and rosenbrock were used with the range argument to obtain dsn, then an additional option is available to control the number of points used to produce the plot. The refine=v option tells odeplot to use v times the number of stored points for the plot, where v must be a non-negative integer or one over a non-negative integer.


For example, specification of refine=1 tells odeplot to use all points in the stored solution, while refine=2 requests twice the computed points, and refine=1/3 requests one-third the computed points.


Note: Use of this option with a range solution of dsolve/numeric produces an adaptive plot, where more points are plotted in more rapidly changing solution regions (that is, regions where a greater number of steps were required by the numerical method). See the Van der Pol example below.


Note: This option cannot be used with the numpoints option.


If not specified, the labels of the plot are obtained from the vars argument (or from the dsolve/numeric solution if vars is not specified). Since these are displayed as text, the derivative of yx with respect to x is displayed as y', and the function yx is displayed as y. Variables specified in vars using operator notation, such as Dyx are left unchanged.


For 2-D plots, if the length of the text of an automatically-generated axis label exceeds 10 characters, it is not displayed. To display long labels as a legend (instead of omitting them), specify the labels=legend option.


Labels can be disabled by specifying them as empty strings or identifiers (that is, labels=["",""] or labels=[``,``]).


If the frames=n option is given, then odeplot produces an animation of the solution over the independent variable range for the plot, from lowest to highest value. The final frame of the animation is the same as the plot created without the frames option. Note: The refine option cannot be used with animations, as odeplot must choose the points for the animated plot.


Remaining arguments must be equations of the form option = value. These options are the same as found for plot (in the case of 2-D solution curves) or those found for plot3d (in the case of 3-D solution curves). See plot/options and plot3d/option for details.


The result of a call to odeplot is a PLOT or PLOT3D data structure which can be rendered by the plotting device. You can assign this value to a variable, save it in a file, then read it back in for redisplay. See plot/structure for more details.



dsolve/numeric solution using a range, so odeplot defaults to that range



or with refinement


dsolve/numeric matrix output



Animation of a solution

Note: To play an animation in this help page, right-click (Control-click, on Macintosh) the plot to display the context menu.  Select Animation > Play.



Removing labels






Specification of numpoints


Multiple curves yx and zx against x.  This is the command to create the plot from the Plotting Guide.


Phase plot of yx against zx


Limit the view of the phase plot


Three-dimensional solution curve


The command to create the 3-D plot from the Plotting Guide is


Multiple curves with different options


Same as above, but animated.

Once again, note that to play an animation in this help page, right-click (Control-click, on Macintosh) the plot to display the context menu.  Select Animation > Play.


An example (the Van der Pol equation) where use of a solution with range and plotting with option refine gives a significantly higher quality plot than without:





See Also











Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam