This repository contains functions that are used to visualize the directional field of ordinary differential equations.
To use the directional_field function, we first declare a differential function with two inputs:
dydx = @(x, y) x + y;
We then graph the directional field with the following call:
directional_field(dydx);
Even if the ODE has only one input, to make MATLAB happy we should still define our function handle with two inputs:
dydx = @(x, y) x;
directional_field(dydx);
For a function involving squares, we should include the "element-wise" operator '.':
dydx = @(x, y) sin(x) + y.^2;
directional_field(dydx);
The integral_curves function can be used to add different paths through the directional field, but in its current state the call to MATLAB's built-in function "streamlines" is incredibly slow.