t=t+dt; // value of t add dt and copy result to t

x2=x;// the same x value copy to x2, so x2 is the same as x1

So v=(x2-x1)/dt is always equal to 0.

If you want to calculate velocity, you need to save previous x,

support we save it as xs (define xs first).

Add the following line in the [b]Fixed relations[/b] Page:

v=(x-xs)/dt; // x is the new value , and xs is the previous one.

xs=x;// save x value to xs

You should not reverse the above order. otherwise, you will get the same result=0.

You can add

x=xs= (your initial value) at the [b]Initialization[/b] page.