Ordinary differential equations: Slope field and solution curves with Matlab
Drawing a slope field <br> [MATLAB task]
We consider the differential equation \[\frac{\dd y}{\dd t}=1-2t y\]
- Create a MATLAB program that draws the slope field below for this differential equation by using only primitive graphic elements such as
Line
to draw a lineal element (i.e., do not use the built-inquiver
function). - Now write a MATLAB program that randomly draws 2,000 lineal elements in the region \(0\le t\le 2, 0\le y\le 2, \), as in the figure below. Just like iron filings make the field lines of a magnetic field visible, the random drawing of lineal elements gives an impression of solution curves of the differential equation.
Unlock full access