I have one cycle of the following signal stored in a memory:

 x(n)=sin(2 * pi * n/N + theta)

 where  theta= 2*pi*q/N and q, N are integers. 

How do I use these values to obtain sinusoides (samples) with same frequency but different phase?


If the values are stored in a linear array indexed by $n$, read the values out sequentially from a different starting point in the array, that is beginning with a nonzero value of $n$, and have the read out "wrap" around the end of the array, that is, the incrementing of the index is done modulo $N$. This gives sinusoids with possible initial phases $0, 2\pi/N, (2)2\pi/N, (3)2\pi/N, \ldots, (N-1)2\pi/N$ depending on the choice of starting point of the read out. If you want other values for the initial phase, you will need to do some computations, and not just a plain reading out from memory.

  • 1
    $\begingroup$ +1. Just to expound on Dilip's last comment a bit, if you want fine-grained phase values that don't correspond exactly to your table indices (a common occurrence), you have two options: 1. increase your table size (you obviously have to stop somewhere) or 2. interpolate between values. If your table is large enough to begin with, then you should be able to get away with simple linear interpolation between points for most applications. $\endgroup$
    – Jason R
    Feb 5 '13 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.