x1 position of the ball - 0 when the ball touches EM1, 0.016 when the ball touches EM2 - unit [meter]
x2 velocity - unit [meter per second]
x3 current in EM1 - unit [Ampere]
x4 current in EM2 - unit [Ampere]

Only magnet ball is movable
[/quote]

Please provide the possible range of x1 (from 0 to ???)
From the above picture $x1\in [0,0.016]$  , do you mean $0\le x1\le 0.016$.
However, the initial value for x1 is 0.09 in your source code. I am really confused.
Please also provide the size of the ball and Initial values for x2,x3,x4

I need those information in order to help (Those values assigned in the maglevkam.ejs  are different from what you have provided in the previous posts).