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.
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
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 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.