Change demand as the model runs: demand =
tmax = 10; dt = .01; InitGraph(); ScaleWindow(0,-10,tmax,30); DrawAxes(); Label('Position control - limit at 1.0',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; if (u>1){u = 1;} if (u<-1){u = -1;} v= v + u*dt; x= x + v*dt; t = t + dt; LineTo(t, x); if (t