If the capacitor is not connected to any electric circuit, then the electric charges on the plates remain constant and the voltage varies when the plates move with respect to each other, and the force is the negative gradient of the electrostatic potential energy as F ( x ) = 1 2 d C ( x ) d x Q 2 C ( x ) 2 = 1 2 d C ( x ) d x V ( x ) 2