dfield9, a MATLAB code which displays the direction field of an ordinary differential equation.

The program allows a user to interactively specify the right hand side of an ordinary differential equation (ODE). The program then displays the corresponding direction field. If the user clicks on any point in the image as an initial condition, the program displays the corresponding solution curve. The original version of this code was by John Polking.

With every new release of MATLAB, this program breaks again!


The computer code and data files described and made available on this web page are distributed under the following license.


dfield9 is available in a MATLAB version.


  1. David Arnold, John Polking,
    Ordinary Differential Equations using Matlab,
    Second Edition,
    Prentice Hall, 1999,
    ISBN: 0130113816,
    LC: QA371.D37.P65.

Related Data and Programs:

pplane9, a MATLAB code which allows a user to interactively explore the phase plane of a system of autonomous ordinary differential equations. On starting the program, the user is given an interface in which to enter the equations and the screen limits, as well as a graphics screen on which the direction field is shown. Clicking any point in the graphics screen results in a trace of the phase plane curve through that point. The program is by Hugh Harvey and George Williams.

Source Code:

Last revised on 07 February 2020.