Windowing a signal in frequency space

AI Thread Summary
The discussion focuses on a Python script designed to process a noisy multi-frequency signal by transforming it to frequency space, applying a Gaussian window, and then transforming it back to time space. The user encounters an issue where the resulting windowed signal contains significant imaginary components, which are comparable to the real parts. This problem arises because applying the Gaussian window alters the symmetry of the signal's spectrum, leading to a complex signal. The conversation highlights the importance of understanding the implications of windowing in frequency space and suggests that the user needs to correctly filter the signal to address the issue. Ultimately, the challenge lies in managing the transformation and filtering process to maintain the integrity of the signal.
mdornfe1
Messages
3
Reaction score
0
I'm not sure if this is the right place to post this, but 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=fftfreq(L,T)    #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?
 
Engineering news on Phys.org
MATLAB fft returns the signal spectrum both for positive and negative frequencies. Of course in your case the signal is real so its spectrum is symmetric under conjugation.
When you multiplied by a window, you eliminated the negative frequencies of the signal, thus transforming it to a complex signal (its spectrum is no longer symmetric).
For a L-point DFT (suppose L is even), the indices 1:L/2 in the vector correspond to the frequencies [0,pi), and the indices (L/2+1):L correspond to the frequencies [-pi,0) (in the same order).
I'll leave it up to you to figure out how to correctly filter the signal with the Gaussian window.
 
Thread 'Weird near-field phenomenon I get in my EM simulation'
I recently made a basic simulation of wire antennas and I am not sure if the near field in my simulation is modeled correctly. One of the things that worry me is the fact that sometimes I see in my simulation "movements" in the near field that seems to be faster than the speed of wave propagation I defined (the speed of light in the simulation). Specifically I see "nodes" of low amplitude in the E field that are quickly "emitted" from the antenna and then slow down as they approach the far...
Hello dear reader, a brief introduction: Some 4 years ago someone started developing health related issues, apparently due to exposure to RF & ELF related frequencies and/or fields (Magnetic). This is currently becoming known as EHS. (Electromagnetic hypersensitivity is a claimed sensitivity to electromagnetic fields, to which adverse symptoms are attributed.) She experiences a deep burning sensation throughout her entire body, leaving her in pain and exhausted after a pulse has occurred...

Similar threads

Replies
2
Views
2K
Replies
10
Views
3K
Replies
1
Views
2K
Replies
8
Views
2K
Replies
3
Views
1K
Back
Top