Do you mean you have an analog linear positioning drive of some sort, and you want to control its position as a function of time as
where x0 is the center point, L is half the total travel, and t0 is the duration of each full cycle of movement?
x(t) = x0 + L sin (2 π t / t0)
Or do you mean you want to find out how to calculate the required velocity to move the drive to a new position using a sine acceleration curve? In other words, for each stroke from x0 to x1 in time t = 0 .. t1:
which has a velocity curve
x(t) = x0 + (x1 - x0) (1 - cos( π t / t1 ) ) / 2
(a single "hump" of a sine wave, a half wave from zero to max velocity back to zero).
v(t) = π (x1 - x0) / t1) sin( π t / t1 )
Since you have an analog linear positioning drive, the latter also gives you the PWM duty cycle you need to drive the analog motor:
and the sign of v(t) tells you the direction.
duty(t) = dutymax / vmax |v(t)|
In real life you cannot control the duty cycle continously, so you need to discretize the algorithm (which replaces a short interval of the curve with a fixed value of the same duration, that has the same effect). Instead of v(t) or duty(t), you need dutyi for i = 0 .. N-1 steps, N = round(t1·rate).
The simplest option is to first do the calculations like I showed above to make sure the curve yields the desired velocity or acceleration profile, then set the duty cycle for each sampling period to the value that yields the desired movement. Assuming for a smooth movement from point x0 to x1 in N steps (t1 time duration), with initial and final velocities zero, you get
ti = i / N t1
Δxi = x(ti+1) - x(ti) = (x1 - x0) ( cos(π i / N + π / N) - cos(π i / N) ) / 2
dutyi = dutymax / vmax Δxi
To compute the sine and cosine, use the CORDIC algorithm. If computation speed becomes an issue, you can try replacing cos(π i / N + π / N) - cos(π i / N) with the mathematically equivalent, but simpler
dutyi = dutymax / vmax (x1 - x0) ( cos(π i / N + π / N) - cos(π i / N) ) / 2, i = 0 .. N-1
const1 cos(π i / N) - const2 sin(π i / N)
const1 = cos(π / N) - 1
const2 = sin(π / N)