Hey Xavier,
I understand that you are encountering errors while trying to simulate the trajectory of a P560 robot.
Firstly, you are passing ‘qr’ to the ‘jtraj’ function which is not defined in the code. This might be the reason you are encountering errors.
Secondly, the code you have provided suggests that you are using Peter Corke’s Robotics Toolbox to simulate the PUMA 560 robot. I am assuming you have installed that. This Toolbox, the Robotics Toolbox for MATLAB, is different to the MathWorks’s own Robotic Systems Toolbox. If not, you may do so by referring to the following link:
Please share the exact errors you are encountering in case you need further help.
Hope this helps!