The arm has been modeled in Solidworks and then imported in MATLAB. While importing, simscape multibody gets all the information i.e mass, inertia from solidworks.

full arm assembly

       Arm model in Solidworks

This 2DOF arm has two servo motors, each connected with a link. After the model is ready, it has been imported in MATLAB.

Simulink model of the robotic arm

   Simulink model of the robotic arm

Tip of the robotic arm draws a square. The coordinates that the tip will follow is provided by the signal builder block. As the arm tip draws the square, the torque needed is calculated for each servo motor.

torque for motor1

           Torque for motor1

torque for motor2

        Torque for motor 2

In this way, required torque in each joint can be calculated to follow a specified path. Thus, motor size can be decided for any purpose.