You can use the Phase Plane and Slope Field apps to qualitatively analyze ordinary differential equations (ODEs).
Phase Plane app: Analyze two-dimensional autonomous ODE systems. | Slope Field app: Analyze single variable ODEs. |
These apps capture the functionality of the traditional PPlane and DField apps created by John C. Polking in MATLAB between 1995 and 2003 [1]. While similar in function to the original apps, the Slope Field and Phase Plane apps have been written entirely from scratch in MATLAB App Designer using modern MATLAB coding practices. This makes the new apps easier to maintain, edit, and use.
- Updated to offer both dark mode and light mode for plotting region.
- Removed unused function in Phase Plane app.
- Improved user message when changing the solver field density slider.
- Fixed case choices on slider labels to be consistent with each other.
- Removed ode15i from offered solvers because it is an implicit solver that requires a different equation structure than these apps are designed to study.
- Updated field arrows with solid arrowheads. These fix the distortion that was visible when the axes were scaled differently.
- Default field color is darker. Also, an option has been added to set a custom field color (in the Appearance menu).
- The solver now allows complex solutions but only plots the real part.
- Added options for the numerical estimation of separatrices.
- Added options to export the field to a figure.
- Qualitative Analysis of ODEs: an accompanying set of live scripts that teach the basics of qualitative ODE analysis using these apps.
- Thank you to Roy Goodman at NJIT for his support of this project and many insightful suggestions.
- Ensure that you have MATLAB R2021a or newer installed.
- Download and unzip the entire repository.
- Double-click each app installer (SlopeField.mlappinstall and PhasePlane.mlappinstall) and follow the installation instructions.
- Access the apps from the APPS tab in the MATLAB toolstrip. Use the dropdown to expand the menu.
- Double-click each app installer (SlopeField.mlappinstall and PhasePlane.mlappinstall) and follow the installation instructions.
- Access the apps from the APPS tab in the MATLAB toolstrip. Use the dropdown to expand the menu.
Learn the basics of the Phase Plane and Slope Field apps in these 3-minute tutorial videos.
Phase.Plane.Tutorial.mp4
Slope.Field.Tutorial.mp4
As an alternative to the videos, you can use these PDF quick start guides to get up and running quickly.
Requires MATLAB release R2021a or newer
The license for the Phase Plane and Slope Field apps is available in the LICENSE.md file in this GitHub repository.
Find an issue or need help? Email the MathWorks teaching resources team: [email protected]
If you want to contribute directly to this project, you can find information about how to do so in the CONTRIBUTING.md page on GitHub.
The details of the Phase Plane app are documented here for reference. The Phase Plane app has four main areas you can interact with:
Each of these areas is described below.
Functionality | Action |
---|---|
Define an ODE system | Type the two dependent variable names in the first two fields and the ODE expressions in terms of the dependent variables and any parameters you defined. |
Define a parameter | Type the name of the parameter in the first field. Type the value in the second field. You can use a valid MATLAB expression, such as log(2), but you cannot use other parameters or variables. |
Update the phase plane field with the edited ODE system | Click Update |
Clear the differential equation system and parameter fields | Click Clear |
Use the default ODE system | Click Default |
Functionality | Action |
---|---|
Generate a solution | Click the phase plane |
Delete a solution | Right-click a solution curve |
Highlight a solution | Left-click a solution curve |
Remove highlighting | Left- or right-click a highlighted curve |
Solve from a numerically defined initial condition | Set the initial values in the x0 and y0 edit fields. Then press Solve from (x0,y0). |
Clear solution curves | Click Clear solutions |
Show the analysis for an equilibrium point | Click an equilibrium point (equilibria are generated from the Analysis menu) |
Functionality | Action |
---|---|
Change the phase plane horizontal axis limits | Type values of xmin and xmax |
Change the phase plane vertical axis limits | Type values of ymin and ymax |
Change the time series horizontal axis limits | Type values of tmin and tmax |
Speed up or slow down the animation | Move the Animation speed slider |
Toggle the time series plots | Click the Time series checkbox |
Increase or decrease the widths of solution curves | Use the spinner or type a new value for Line width |
Increase or decrease the number of field arrows | Use the spinner or type a new value for Field density |
Increase or decrease the size of the field arrows | Use the spinner or type a new value for Field scale |
Functionality | Action |
---|---|
Change the solver time span. The ODE solver will start at t=0 and solve both forward and backward in time based on the defined values. | Edit the Forward solution tmax and Backward solution tmin fields. |
Allow the solver to continue beyond the axis limits | Uncheck Terminate solutions at axis limits |
Change how many solutions are generated when the Solve from region functionality is used | Adjust the Solve from region density slider |
Functionality | Action |
---|---|
Change the variable step ODE solver | Select a solver from the Solver dropdown |
Change the ODE solver relative tolerance | Enter a new value in the Relative tolerance field |
Change the ODE solver absolute tolerance | Enter a new value in the Absolute tolerance field |
The ODE solver automatically terminates if it runs for too long (in real time). You can adjust how long the solver will run. | Type a new value for Max solver wall clock (s) |
Use a fixed step solver | Press the Fixed step button |
Use a different fixed step solver. Note that implicit methods use a Newton iteration at each step and, as a result, solve slowly. | Select a solver from Solver dropdown |
Use a different step in the numerical integration | Type a new value for Step size |
Functionality | Action |
---|---|
Numerically solve for an equilibrium of the system. Equilibria occur where x'(t)=0 and y'(t)=0. This function uses the Newton-Raphson method with a finite-difference Jacobian to solve for zeros of the differential equation system. | Select Find nearby equilibrium. Then, click the phase plane near the suspected equilibrium point. |
Find equilibria in the phase plane. This method scans the plane using a grid of initial guesses and records all equilibria found. The Newton-Raphson method is used to solve for zeros of the differential equation system. | Select Scan for equilibria |
Clear the equilibria | Select Clear equilibria |
Solve for saddle separatrices. Saddle separatrices are numerically estimated by generating a solution an increment away from each saddle equilibrium in the directions of the eigenvectors. Before solving for saddle separatrices, you should scan for equilibria. | Select Solve for saddle separatrices |
Clear the separatrices | Select Clear separatrices |
Show nullclines or hide nullclines. Nullclines are curves along which x'(t) = 0 or y'(t) = 0. Nullclines with x'(t) = 0 are blue and those with y'(t) = 0 red. Intersections of the nullclines are equilibria since x'(t) and y'(t) are both zero. | Select Show nullclines |
Automatically generate isoclines. Isoclines are curves along which the phase plane field directions are constant: y'(t)/x'(t) = m. | Select Auto-generate isoclines. Then, enter an integer for how many isoclines you want to generate. |
Draw an isocline curve through a point. | Select Draw isocline through a point. Then, click the phase plane. |
Draw isoclines with specified values. | Select Draw several isoclines. Then, type a list of slope values. For example: -1 3 5 |
Clear the isoclines | Select Clear isoclines |
Functionality | Action |
---|---|
Generate several solutions starting within a region | Select Solve > Solve from region. Then, click once on the phase plane to start drawing, draw your region, and click again to stop drawing. |
Draw a solution on the phase plane | Select Draw > Draw solution. Then, click once on the phase plane to start drawing, draw your solution, and click again to stop drawing. |
Draw a solution on the phase plane and compare it to the numerical solution | Select Draw > Draw and compare solution. Then, click once on the phase plane to start drawing, draw your solution, and click again to stop drawing. |
Functionality | Action |
---|---|
Toggle solution animations | Select Animate solution |
Toggle initial value labels | Select Point labels |
Toggle the location of the axes | Select Axis through origin |
Toggle dark mode | Select Dark mode |
Toggle light mode | Select Light mode |
Toggle between showing the field arrows with magnitude and orientation and orientation only | Select Field orientation only |
Functionality | Action |
---|---|
Set the differential equation to a standard system | Select one of the systems from the Library menu |
Add the current system to the Custom library tab | Select Custom library > Add current system |
Save the current custom library to a MAT file | Select Custom library > Save |
Load a custom library MAT file (note: the custom library should be one created by the Phase Plane app) | Select Custom library > Load |
Clear the current custom library | Select Custom library > Clear |
Functionality | Action |
---|---|
Export the phase plane portrait and time series to an image file. This method includes the equations in the exported image. | Select Export to PNG |
Export the phase plane portrait and time series to a scalable vector graphics file (this format is useful for editing or high resolution website display). This method includes the equations in the exported image. | Select Export to SVG |
Export the phase plane portrait and time series to a PDF. This method includes the equations in the exported image. | Select Export to PDF |
Export the phase plane portrait to an image file | Select Export portrait only to PNG |
Export the phase plane portrait to a scalable vector graphics file | Select Export portrait only to SVG |
Export the phase plane portrait to a PDF | Select Export portrait only to PDF |
The details of the Slope Field app are documented here for reference. The Slope Field app has four main areas you can interact with:
Each of these areas is described below.
Functionality | Action |
---|---|
Define an ODE | Type the dependent variable name and the ODE expression in terms of the dependent variable and the independent variable t. |
Define a parameter | Type the name of the parameter in the first field. Type the value in the second field. You can use a valid MATLAB expression, such as log(2), but you cannot use other parameters or variables. |
Update the slope field with a new equation | Click Update |
Clear the differential equation and parameters | Click Clear |
Use the default ODE | Click Default |
Functionality | Action |
---|---|
Generate a solution | Click the slope field |
Delete a solution | Right-click a solution curve |
Highlight a solution | Left-click a solution curve |
Remove highlighting | Left- or right-click a highlighted curve |
Solve from a numerically defined initial condition | Set the initial values in the t0 and x0 edit fields. Then press Solve from (t0,x0). |
Clear solution curves | Click Clear solutions |
Functionality | Action |
---|---|
Change the horizontal axis limits | Type values of tmin and tmax |
Change the vertical axis limits | Type values of xmin and xmax |
Speed up or slow down the animation | Move the Animation speed slider |
Increase or decrease the widths of solution curves | Use the spinner or type a new value for Line width |
Increase or decrease the number of slope field arrows | Use the spinner or type a new value for Field density |
Increase or decrease the size of the slope field arrows | Use the spinner or type a new value for Field scale |
Functionality | Action |
---|---|
Allow solver to continue beyond axis limits | Uncheck Terminate solutions at axis limits |
Change how many solutions are generated when the Solve from region functionality is used | Adjust the Solve from region density slider |
Functionality | Action |
---|---|
Change the variable step ode solver | Select a solver from the Solver dropdown |
Change the ODE solver relative tolerance | Enter a new value in the Relative tolerance field |
Change the ODE solver absolute tolerance | Enter a new value in the Absolute tolerance field |
The ODE solver automatically terminates if it runs for too long (in real time). You can adjust how long the solver will run. | Type a new value for Max solver wall clock (s) |
Use a fixed step solver | Press the Fixed step button |
Use a different fixed step solver. Note that implicit methods use a Newton iteration at each step and, as a result, solve slowly. | Select a solver from the Solver dropdown |
Use a different step in the numerical integration | Type a new value for Step size |
Functionality | Action |
---|---|
Show nullclines or hide nullclines. Nullclines are curves along which x'(t) = 0. | Select Show nullclines |
Automatically generate isoclines. Isoclines are curves along which the derivative is constant: x'(t) = m. | Select Auto-generate isoclines. Then, enter an integer for how many isoclines you wish to generate. |
Draw an isocline curve through a point. | Select Draw isocline through a point. Then, click the slope field. |
Draw isoclines with specified slope values. | Select Draw several isoclines. Then, type a list of slope values. For example: -1 3 5 |
Clear the isoclines | Select Clear isoclines |
Functionality | Action |
---|---|
Generate several solutions starting within a region | Select Solve > Solve from region. Then, click once on the slope field to start drawing, draw your region, and click again to stop drawing. |
Draw a solution on the slope field | Select Draw > Draw solution. Then, click once on the slope field to start drawing, draw your solution, and click again to stop drawing. |
Draw a solution on the slope field and compare it to the numerical solution | Select Draw > Draw and compare solution. Then, click once on the slope field to start drawing, draw your solution, and click again to stop drawing. |
Functionality | Action |
---|---|
Toggle solution animations | Select Animate solution |
Toggle initial value labels | Select Point labels |
Toggle the location of the axes | Select Axis through origin |
Toggle dark mode | Select Dark mode |
Toggle light mode | Select Light mode |
Toggle between showing the field arrows with magnitude and orientation and orientation only | Select Field orientation only |
Functionality | Action |
---|---|
Set the differential equation to a standard system | Select one of the systems from the Library menu |
Add the current system to the Custom library tab | Select Custom library > Add current system |
Save the current custom library to a MAT file | Select Custom library > Save |
Load a custom library MAT file (note: the custom library should be one created by the Slope Field app) | Select Custom library > Load |
Clear the current custom library | Select Custom library > Clear |
Functionality | Action |
---|---|
Export the Slope Field to an image file | Select Export to PNG |
Export the Slope Field to a scalable vector graphics file (this format is useful for editing or high resolution website display) | Select Export to SVG |
Export the Slope Field to a PDF | Select Export to PDF |
[1] John C. Polking. DField and PPlane [Computer software]. (1995-2003). Available online: https://math.rice.edu/~polking/odesoft/dfpp.html
© Copyright 2023 The MathWorks, Inc.