Skip to main content

Plotting the direction field of a differential equation


I have to sketch the direction field for the following differential equation:


$$\frac{dy}{dx}=\frac{-0.02 y +0.00002 xy}{0.08 x-0.001xy}$$


This is the code I used, which gives an incorrect plot:


StreamPlot[Normalize[{1, (y (-0.016 + 0.00008 x))/(x (0.12 - 0.006 y))}], 
{x, -200, 200}, {y, -200, 200}, Axes -> True]



The following picture shows what I need to get:


enter image description here



Answer



I believe this is getting close to what you want:


f[x_, y_] := (-0.02 y + 0.00002 x y)/(0.08 x - 0.001 x y)

VectorPlot[{1, f[x, y]}, {x, 0, 3100}, {y, 0, 150}, VectorStyle -> Arrowheads[{}]]


enter image description here


Comments