Is it possible to write a force equation in SolidWorks Motion Analysis that is a function of an existing mechanical distance and not a function of time?

I have question about a SW motion simulation.
I would like to know if it is possible perform a motion analysis in SW using a force equation which the variable is a mechanical distance and not time.
This is typical of magnetic forces in a solenoid, for example. See the attached picture.
I couldn't determine whether SW is capable of considering a system with a force of that nature and I couldn't find any references on the internet either.
Apparently, the equations I can write in SW Motion Analysis can only be a function of time.
So, would there be a specialist who could clarify whether or not this capability exists and, if so, provide me with an example or a bibliographic reference for me to consult?
I thank you in advance.

2 Answers

Hello Fernando,
SolidWORKS Motion provides you with many ways to enter equations (of a force, in this case) as a function of times, speeds, distances, etc. etc. You can even do it by points, as I show you in the figures.
Luck!
PS: be careful with the analytical expression of the force of your magnet because "the X" should never go through the value zero (it would make the force infinite).

I uploaded a small model (SolidWorks 2017) that has a fixed base, a mass, a linear spring and "a position dependent force" defined (I put a constant divided by the square of the distance to make it similar to what you wrote in your image). I hope you find it useful!

Masa-resorte en el campo de un IMAN