A Mechanical System with Algebraic Constraints

This mass-spring-damper system includes a rigid bar that can prevent the motion of the second mass.

    
Obtain a descriptor StateSpaceModel representation:
Use OutputResponse to simulate the system both when the bar is locked and unlocked: