What I want to do is apply a frequency-independent phase shift to a Gaussian Noise signal. Obviously I can just invert it to get a pi shift. Also I can take the Hilbert transform to get a pi/2 shift and I can invert that to give myself in effect a 3/2pi shift. BUT..... what I want to do is to be able to apply any phase shift, 10, 20, 30 degrees etc.(adsbygoogle = window.adsbygoogle || []).push({});

The way I have been thinking about this is that I can take the FFT of the noise and get the magnitude and phase information, and then I could manipulate the phase but leave the magnitude the same and take the IFFT to get my phase-shifted signal. Here is an example bit of matlab code doing this on a single sinusoid. As it is here the code doesn't work. But if you change the phase shift p from pi/2 to pi then it does? Is there something I'm missing. Perhaps I need to apply the phase shift differently to the positive and negative parts of the FFT? Or is it something to do with the fact that theta is distributed on [-pi pi] and when I add "p" I change this and make it ambiguous or something?

sr=10000;

dt=1/sr;

len=0.5;

t=0:dt:len;

f=500;

%generate signal

sig=sin(2*pi*f*t);

%Define a phase shift in rads

p=pi/2;

%Get the FFT of the signal

z=fft(sig);

%Get the magnitude

mag=abs(z);

%Get the phase

theta=angle(z);

%Add the phase shift onto the phase

theta=theta+p;

%Set the new real and imag parts of the spectrum

R=mag.*cos(theta);

I=mag.*sin(theta);

%Make the new spectrum

spec=complex(R,I);

%Get the new signal

newsig=real(ifft(spec));

%plot the signals

figure;plot(t,sig);hold on; plot(t,newsig,'g');

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Phase shift using FFT

Loading...

Similar Threads - Phase shift using | Date |
---|---|

Bode phase plots and initial angles of transfer functions | Apr 29, 2017 |

What is a distinct phase change? | Apr 24, 2017 |

How to calculate time to change the temperature of metal | Nov 7, 2016 |

Simulation of phase change materials | May 22, 2016 |

Matlab - calculate phase shift using fft | Apr 15, 2015 |

**Physics Forums - The Fusion of Science and Community**