New Reply

Windowing a signal in frequency space

 
Share Thread
Jun26-12, 02:42 PM   #1
 

Windowing a signal in frequency space


I'm trying to write a python script that takes a noisy multi frequency signal, transforms it to frequency space, windows it there with a gaussian, then transforms it back to time space. Here is what I wrote:

Code:
Fs=1000     #sampling frequency
fo=120      #center of gaussian   
sigma=0.01  #inverse width of gaussian
T=1./Fs
L=2**10     #number of samples
t=arange(0,L)*T #time vector
f=Fs*linspace(0,1,L)    #frequency vector
x=0.7*sin(2*pi*50*t) + sin(2*pi*120*t)+randn(t.size)/sqrt(t.size)   #signal
x_fft=fft(x)
W=exp(-square(2*pi*sigma*(f-fo)))   #gaussian window
y=ifft(W*x_fft)                      #windowed signal
The problem I'm running into is the windowed signal y has non negligible imaginary parts. They're about the same order as the real parts. Does anyone know why I might be getting this?
PhysOrg.com science news on PhysOrg.com

>> New language discovery reveals linguistic insights
>> US official: Solar plane to help ground energy use (Update)
>> Four microphones, computer algorithm enough to produce 3-D model of simple, convex room
Jun27-12, 03:00 PM   #2
 
Any chance you are getting a complex vector when you were expecting a,b as in a*cos(n*t)+b*sin(n*t)?

Or are you perhaps thinking you want the magnitude at each frequency and not the phase information?
Jun27-12, 03:31 PM   #3
 
I just realized what was happening. When I multiplied the transformed signal by the gaussian, I cancelled out the negative frequency components. So of course when I transformed back the signal would be complex. I was expecting it to be a real sinusoid not a complex one.
New Reply

Tags
fft, gaussian window, python, signal analysis

Similar discussions for: Windowing a signal in frequency space
Thread Forum Replies
Signal Windowing Help Engineering, Comp Sci, & Technology Homework 0
how to convert time domaine signal into frequency domain signal Electrical Engineering 3
signal frequency!!! General Engineering 5
frequency spectrum of the modulated signal g(t) Engineering, Comp Sci, & Technology Homework 3
Low frequency signal Electrical Engineering 2