Change target as the model runs: target =
tmax=20; InitGraph(); ScaleWindow(-2.5,-2.5,2.5,2.5); DrawAxes(); Label('Phase Plane - Velocity vs Position',-2,2); Label('Position',2,-.2); Label('Velocity',.1,2); f=8; //Feedback coefficient d=2; //damping coefficient t=0; LineStart(x, v); StepModel();
//function StepModel() Colour(Black); u = f*(xtarget - x) -d * v; v = v + u * dt; x = x + v * dt; t = t + dt; Spot(x, v); if (t