MATLAB: Inserting code in sim-mechanics model

simmechanicssimulink

How to add functions to Sim-mechanics model. I wish to add functions to control force acting on a body and path planning in a Sim-mechanics model.

Best Answer

Use Sensor blocks to measure the motion (position, velocity, acceleration of bodies and joints). In Simulink implement any function you want and feed the computed force to SimMechanics using Actuator blocks.