Hello DOREL,
As per my understanding, you are trying to model the Forward and Inverse Kinematics of the SCARA Robot in Simulink.
The error that you shared seems to suggest that your model has an Algebraic Loop present. An algebraic loop occurs when a signal loop in a model contains only blocks that have direct feedthrough. A signal loop that contains only blocks with direct feedthrough creates a circular dependency of block output and input values in the same time step. The resulting equation is an algebraic equation that requires a solution at each time step and adds computational cost.
Because of this certain Simulink models may face problems during simulation. Hence, it would be good if you could find and remove them from your model.
To improve your model further, you should make use of more Simulink based blocks compared to MATLAB functions. Inclusion of MATLAB functions should only be done when Simulink blocks for the same purpose are not available. For your case, you can either use other Mathematical Simulink Blocks or Simulink blocks for Forward and Inverse Kinematics.
For more information, you can refer to the following documentations:
Algebraic Loops: Algebraic Loop Concepts - MATLAB & Simulink (mathworks.com)
Removing Algebraic Loops: Remove Algebraic Loops - MATLAB & Simulink (mathworks.com)
Inverse Kinematics Block Simulink: Compute joint configurations to achieve an end-effector pose - Simulink (mathworks.com)
Get Transform Block Simulink: Get transform between body frames - Simulink (mathworks.com)