Change demand as the model runs: demand =
tmax = 10; dt = .01; InitGraph(); ScaleWindow(0,-10,tmax,30); DrawAxes(); Label('Position control - no limit',1,25); x = 10; v = 0; //Initial position and velocity Colour(Black); t = 0; LineStart(t,x); StepModel();
//executed in StepModel() u = -6*(x-demand) -5*v; v = v + u*dt; x = x + v*dt; t = t + dt; LineTo(t, x); if (t