InitGraph(); ScaleWindow(0,0,5,40); DrawAxes(); var k = .5; var dt = .01; //Edit to try various steplengths var t=0; x=0; //Initial level 0 to 40 u=20; //Input flow 0 to 20 Colour(Black); LineStart(t,x); while (t<5) { x = x + (-k*x + u) * dt; //This is the simulation t = t + dt LineTo(t, x); //This displays the result }