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.
 
Hey guys. I have a question related to electricity and alternating current. Say an alien fictional society developed electricity, and settled on a standard like 73V AC current at 46 Hz. How would appliances be designed, and what impact would the lower frequency and voltage have on transformers, wiring, TVs, computers, LEDs, motors, and heating, assuming the laws of physics and technology are the same as on Earth?
I used to be an HVAC technician. One time I had a service call in which there was no power to the thermostat. The thermostat did not have power because the fuse in the air handler was blown. The fuse in the air handler was blown because there was a low voltage short. The rubber coating on one of the thermostat wires was chewed off by a rodent. The exposed metal in the thermostat wire was touching the metal cabinet of the air handler. This was a low voltage short. This low voltage...
Thread 'Electromagnet magnetic field issue'
Hi Guys We are a bunch a mechanical engineers trying to build a simple electromagnet. Our design is based on a very similar magnet. However, our version is about 10 times less magnetic and we are wondering why. Our coil has exactly same length, same number of layers and turns. What is possibly wrong? PIN and bracket are made of iron and are in electrical contact, exactly like the reference design. Any help will be appreciated. Thanks. edit: even same wire diameter and coil was wounded by a...
Back
Top