Problem: Given the following non autonomous diﬀerential equation, plot the line ﬁelds which represents the solutions of the ODE.

\[ \frac {dy\left ( x\right ) }{dx}=x^2 - y \]

Direction ﬁeld plot (or slope plot) shows solutions for the ODE without actually solving the ODE.

The following are the steps to generate direction ﬁeld plot for \(\frac {dy}{dx}=f(x,y)\)

- generate 2 lists of numbers. The \(y\) list and the \(x\) list. These 2 lists are the coordinates at which a small slop line will be plotted.
- At each of the above coordinates \((y,x)\) evaluate \(f(x,y)\).
- Plot small line starting at the point \((x,y)\) and having slop of \(f(x,y)\). The length of the line is kept small. Normally it has an arrow at the end of it.

Using Matlab, the points are ﬁrst generated (the \((x,y)\) coordinates) then the slope \(f(x,y)\) evaluated at each of these points, then the command quiver() is used. Next contour() command is used to plot few lines of constant slope.

In Mathematica, the command VectorPlot is used. In Maple dfieldplot is used.