# Phase shift in frequency domain

Tags:
1. Jul 8, 2015

### Eng_Pat

Hello,

I'using Matlab to simulate phase shift in frequency domain (FD).
I have got real and imaginary parts of the signal after FFT.
I'd like to use phase shift in FD.

This works:
Y=fft(y);
YY=Y.exp(-i*2*pi*nk/N*samples_delay);
result=ifft(YY);

But in my DSP I can't use the formula above and I need to use real and imaginary parts from fft signal.

I supposed exp(-i*2*pi*nk/N*samples_delay) can be transfered to this:

Shifted real part = re*cos(2*pi*nk/N*samples_delay)
Shifted imaginary part = im*sin(-2*pi*nk/N*samples_delay)

Then I transfered it back to time domain but result is inccorect.

Could anybody help me?

Thank you

2. Jul 8, 2015

### DrGreg

Think about what you are doing. Is it true that$$(a + ib) (x + iy) = ax + iby?$$

3. Jul 8, 2015

### blue_leaf77

From what I understand, you actually want to calculate the real and imaginary parts of YY, am I right? Then you have to calculate Re[Y.exp(-i*2*pi*nk/N*samples_delay)] and Im[Y.exp(-i*2*pi*nk/N*samples_delay)]. Consider this
$$Ze^{i\theta} = (Re[Z] + i Im[Z])(\cos(\theta)+i\sin(\theta) )$$
Calculate the last expression to see which are the right real and imaginary parts of $Ze^{i\theta}$.

4. Jul 9, 2015

### Eng_Pat

Thank you for your answers.
I din't reliaze that so the right code for matlab is this:

Shifted real part = re.*cos(2*pi*nk/N*samples_delay)+im.*sin(2*pi*nk/N*samples_delay)
Shifted imaginary part = re.*sin(2*pi*nk/N*samples_delay)+im.*cos(2*pi*nk/N*samples_delay)

It's working right now.

Thank you very much

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook