I have a real one dimensional signal s (light absorbance in a flow cell), which has significant noise and some periodic noise after performing a deconvolution of $S$ from $S_o$. Basically fft($S$) was divided by the fft($S_o$). Let us call the output as $R$ vector. In order to remove the periodic noise, I replaced the noise region in $R$ with 0+0i in a given range. The ifft($R$) is complex. When I plot t and ifft($R$), MATLAB warns that the imaginary parts of complex R arguments ignored . The output looks as desired, free from noise.
Forum members mention that this can arise due to numerical precision, however the imaginary part in ifft($R$) is on the order of 0.0006i.
Is there is a better window (simple one) than this rectangular window in the frequency domain?
Even in this simpler example which one can test is a simpler code, generates a complex inverse output.
t = [0:1/80:60]'; % Time
x = sin(2 * pi * 2 * t) + sin(2 * pi * 0.05 * t); % Signal
X = fft(x);
X([1:6, 4780:4801]) = 0; % Removing low frequency 0.05 Hz
z = ifft(X); % **z turns out to be complex as well**
figure(1)
plot(t, z)
hold on
figure(2)
plot (abs(X))
Thanks.