The unlatching of muscle fibres is an active process that requires energy and appropriate movement of calcium in and out of cells. If there is insufficient energy or a problematic balance of salts then muscles can’t contract.
Most cramps in my understanding are more that the salt balance in your body goes off when you’re dehydrated and prevents the efficient movement of calcium that allows the muscles to relax.
Further details are available, but its been way too long since I did cell biology to remember much more.
Latest Answers