I have some questions regarding shifting the phase of a fourier transformed spectrum :(adsbygoogle = window.adsbygoogle || []).push({});

I have a spectrum with flux on the Y-axis and wavelength on the X-axis. What I want to do is take the Fourier transform of this spectrum. Then add a random phase between 0 and 2pi to the phase only. Then take the inverse Fourier Transform of this. The piece of code I wrote in IDL for a simple example is below. I was hoping to scramble up the spectrum by doing this. But I am not sure if I have achieved that goal. I have two questions

1. The final spectrum ( for some random phases) are vertically offset from the original spectrum. If the DC component is zero in the original spectrum, then this problem doesnt exist! Why is that so?

2. The amplitude of the final signal varies a lot from the original spectrum. I wasnt expecting that either. why is that?

3. All I want is that the components of the original spectrum be jumbled up in the X-direction (ie the wavelength direction). How can it be done?

MY CODE :

n = 256

x = FINDGEN(n)

y = COS(x*!PI/6)*EXP(-((x - n/2)/30)^2/2)+1.00

tek_color

yfft = fft(y)

magnitude = abs(yfft)

angle = ph(yfft)

for count=0, 300 do begin

rand = randomu(seed, 1)*2*!pi

randph = replicate(rand, 256)

fft_signal = magnitude*exp(complex(0,1)*(angle+randph))

ifft_signal = (fft(fft_signal, /inverse))

wait, 0.2

plot, x, y

oplot, x, (ifft_signal), color=2

endfor

end

**Physics Forums | Science Articles, Homework Help, Discussion**

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

# Randomize phase shift in Fourier Transform

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**