I am have built a PID compensator for a ball-beam system in a MATLAB live script as per this website tutorial: http://ctms.engin.umich.edu/CTMS/index.php?example=BallBeam§ion=ControlPID . I have used the "pidTuner" app in the matlab script to meet the design requirements ( < 3s settling time, < 5% overshoot). This PID has then been changed to a discrete function, and called in a simulink model, using a LTI system block. However, the issue is that even though the MATLAB script gives the desired result, when running the simulation in simulink the result is nowhere near the same. I have no idea why this isn't working. Both the script, and the simulink model are attatched.
I looked at your model of the ball and the beam system in Simulink. It looks like you have implemented the non-linear system and are using the PID controller tuned for the linear system which is why you are seeing bad results. Changing the lagrangian to represent the linear system as described in the link below, I am seeing the same results as the live script.