2

I am trying to find how much an engine would turn until it stops accelerating with an acceleration of $a = A \sin^2(x)$.

Acceleration

Acceleration

Integrating the acceleration I get velocity $v = A(x/2 - \sin(2x)/4) $

Integrating the velocity, I get the distance $d = A(x^2/4 - \cos^2(x)/4) $

Velocity and distance

enter image description here

Now, I need to do this calculation on a microcontroller, without using floating point and with a sine look-up table which is basically a $2048\sin(x\pi/512)$ function.

How can I find the distance correctly using the sine look up table? Or what other way could I use?

nicoguaro
  • 8,500
  • 6
  • 23
  • 49
HYK
  • 21
  • 1
  • 1
    Is the question just how to obtain a cosine function from your sine lookup table? The two are related by a shift of $\pi/2$ (or an offset of 256 in the case of your table).... – horchler Aug 04 '15 at 21:14
  • The problem is if i integrate the lookup function as in Integrate((2048 sin(x Pi/512))^2) the results deviate from the original curve, I get a sinusoidal error in distance. If i try to change the sine and cosines to the look-up versions i get a sinusoidal error in velocity curve. Is this somewhat understandable? – HYK Aug 05 '15 at 13:35
  • Why do you need to integrate your lookup table when you have a closed form equation for everything. You probably need to edit your question to clarify what you're asking. Or spend some more time thinking about this exercise and trying things out. – horchler Aug 05 '15 at 13:39

0 Answers0