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:(adsbygoogle = window.adsbygoogle || []).push({});

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?Code (Text):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

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

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

# Windowing a signal in frequency space

Loading...

Similar Threads - Windowing signal frequency | Date |
---|---|

Linux in Windows | Feb 23, 2018 |

Java How to write an interface that extends window listener | Mar 21, 2017 |

C/++/# How to open a window in just C++ (g++ linux) ? | Mar 16, 2017 |

Python Python on Windows 7 | Jul 18, 2016 |

How Signals Are Sampled and Stored As A Fourier Transform? | Mar 28, 2016 |

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