To gain a better understanding of the types of controllers and their strengths and weakness, I subjected P, PD, and PID controllers of a frictionless cart to a step input. The FBD of this system is shown below, along with the motion of the cart that I derived through conservation of linear momentum and the transfer function that will be simulated.



The following block diagram shows how the code will be implemented for P, PD, and PID control.

I developed MATLAB and Simulink programs to simulate this diagram. Below are the respective plots for each controller setup. The differences in steady-state error, settling time, peak time, and percent overshoot are clearly visible with the different types of controllers.


