Along with the soleus muscle, the gastrocnemius forms half of the calf muscle. Its function is plantar flexing the foot at the ankle joint and flexing the leg at the knee joint.