MATLAB script PID compensator not reciprocating result in simulink model

1 view (last 30 days)
FInnian Monaghan
FInnian Monaghan on 7 Apr 2020
Edited: Siddharth Jawahar on 13 Oct 2020
I am have built a PID compensator for a ball-beam system in a MATLAB live script as per this website tutorial: . 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.
Important note: I have tried to use a discrete PID block instead of the LTI system block, but it gives out this error:
Many thanks in advance.

Answers (1)

Siddharth Jawahar
Siddharth Jawahar on 13 Oct 2020
Edited: Siddharth Jawahar on 13 Oct 2020
Hi Flnnian,
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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!