cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Voyager
Voyager
4,448 Views
Registered: ‎06-26-2015

add phase shift to signal

just like to know how do I add phase shift to a sin signal?  is it just exp(-j 2*pi/4) if I want 90 degree phase shift?   also can I use cordic for phase shift?

0 Kudos
8 Replies
Highlighted
Scholar
Scholar
4,442 Views
Registered: ‎03-22-2016

@s002wjhw

In general 

s = A*exp( i*(w*t + P) )

 

where 

 

A = amplitude

w = 2*PI*f  (frequency in radians/sec)

t = time

P = phase

 

 If you want to change the phase, you just add PI/4 to P.  However if you do this at once, it will produce a 'click' sound or in radio transmissions, it will spill over the entire spectrum.  You got to add phase incrementally over a period of time. The bigger the period, less spillover.

 

Interestingly enough, this extra phase added over a certain period of time is the exact definition of frequency. So let's say you add an extra phase H over a period of time T such that

 

phase = H*t/T

 

Then the formula becomes

 

s = A*exp( i*(w*t + P) ) = A*exp( i*(w*t + H*t/T) ) = A*exp( (i*(w + H/T)*t) ) 

 

in other words, in the transition phase you are increasing the frequency by H/(2*PI*T). This can be seen on a git repo I wrote some time ago. Look at WaveGenerator::recalc()

https://github.com/HFTrader/WavDecoder/blob/master/WaveGenerator.h

 

 

 

 

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
0 Kudos
Highlighted
Voyager
Voyager
4,417 Views
Registered: ‎06-26-2015

thx,
say if I want produce this phase incrementally so it doesn't has that click you mention.

is its
exp(i*w*n)*exp(i*p) say exp(I*w*n)=x(n) my signal.
then its x(n)*exp(I*p). then all I really need is a constant phase * every sample of x(n).
0 Kudos
Highlighted
Scholar
Scholar
4,414 Views
Registered: ‎03-22-2016

@s002wjhw

Basically, yes.

However notice that p is increasing, it is not a constant. But you can do something like 

c0 = exp(i*P/T) ; // phase incremental per time step
ct = 1  // phase added
for ( j ... ) {
    y[j] = x[j] * ct;  // add phase to signal
    ct = ct * c0;  // increment phase
}

 That should work.

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
0 Kudos
Highlighted
Voyager
Voyager
4,410 Views
Registered: ‎06-26-2015

also, I read somewhere that I can supersampling a signal by adjusting its offset.
so if I have 100mhz, want to produce 200mhz sample. I need combine the 100mhz and 100mhz with phase offset of 2pi/pi. This produce 2 signal in parallel when combine give me 200mhz. anyone has an idea how this work or has article on it? I can't seem to get it working in matlab.
0 Kudos
Highlighted
Scholar
Scholar
4,408 Views
Registered: ‎03-22-2016

@s002wjhw This is the basic of superheterodyne receivers

https://en.wikipedia.org/wiki/Superheterodyne_receiver

 

exp( i*(w+W)*t ) = exp( i*w*t + i*W*t ) = exp( i*w*t )*exp(i*W*t)

 

So basically you set a cordic on frequency W and multiply it by your signal.

The problem with real (non complex) signals is that you create TWO other signals at (w+W) and (w-W) so you have to use a low/band pass filter to eliminate w-W.

 

sin(w*t)sin(W*t) = 0.5*cos(w*t-W*t) - 0.5*cos(w*t+W*t)

 

 https://en.wikipedia.org/wiki/Heterodyne#Mathematical_principle

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
0 Kudos
Highlighted
Voyager
Voyager
4,396 Views
Registered: ‎06-26-2015

thx for the info, DSP is not really my specialty.
i was gonna use 8xDDS in parallel to have a supersample of 800mhz(each dds 100mhz with constant offset of 2pi/8) I'm attempt to do the same in matlab 1st, by modify 8*100mhz wave with phase offset, but like you said there is the phase accumlations. Then combine into 800mhz, but my code didn't work, so I'm searching article/example on polyphase dds. couldn't seem find too much info
0 Kudos
Highlighted
Voyager
Voyager
4,395 Views
Registered: ‎06-26-2015

if i have

x1 = cos(2*pi*100e6*t);
x2 = cos(2*pi*100e6*t+pi);

how would i combine the two into 200e6 signal for supersampling?
0 Kudos
Highlighted
Voyager
Voyager
4,394 Views
Registered: ‎06-26-2015

i thought about the mixer method, but i heard there are other method by using polyphase rather then multiplication of two signal.
0 Kudos