MATLAB: I am getting velocity and position as zero even after applying non zero force on linear spring

MATLABSimscapesimulinktranslational spring simscape example

Best Answer

Your link was broken but I was able to change the URL until the screenshot came up.
So, I see two issues with this model.
  1. Force is what is considered a "Through" variable, and should therefore be sensed in series and not in parallel. By placing a Force Sensor in parallel with the force source, you're essentially creating a short circuit and therefore no force "flows" into the spring.
  2. I would add a Mass block at the node between the spring and the force source. In fact, this is the reason why you got the "derivatives" error and why you ended up having to supply a first derivative of force. The spring cannot do anything with a pure force signal unless there's a mass to convert that force to acceleration.
- Sebastian
Related Question