In MATLAB, you can simulate a geared system using the Simscape Multibody toolbox. The following steps are required to get started:
Open a new Simulink model.
Go to the Simulink Library Browser and navigate to the Simscape Multibody > Frames & Transforms > Frames library.
Drag and drop the "Frame" block into the model. Add as many Frame blocks as you need.
Connect the Frame blocks together to create a kinematic chain.
On the last frame in the chain, add a Revolute Joint block.
Connect the joint to an Actuator block that will control its motion.
Set the gear ratio of the joint using the gearbox tab of the joint block parameters.
Run the simulation to see the movement of the joint under control of the actuator.
More detailed information and examples of how to simulate geared systems in MATLAB can be found in the official documentation: https://www.mathworks.com/help/physmod/sm/ug/modeling-geared-mechanical-systems.html
gistlibby LogSnag