Hi,
1- as a spring with negative constant
2- determine field magnetic force at a reference distance, then divide the force by the distance. Example: in the case of a generator, calculate field asymmetry at 10% of the air-gap, calculate magnetic force, then K=-F/(0.1*a).