How to remove sine in FFT
3 views (last 30 days)
Show older comments
Hi,
I would like to apologize for my little knowledge in FFT. However, I have several images taken with a CCD that contains a single spectral line (Gaussian) and a sinusoidal pattern. Now, I would like to remove the sinusoidal pattern via FFT which should be basically no problem. I do have exposures of just the sinusoidal patter which I use as template. I am not sure how to remove the sine in Fourier space. I just would like to summarize what I did so far:
R = reference sine S = signal (spectral line + sine)
Fs= length(R);
x = linspace(1,Fs,Fs)
% plot signals
figure();
plot(x,S); hold on
plot(x,R);
xlabel('Pixel')
ylabel('Intensity');
nfft = 1024; % Length of FFT
% Frequency vector
freq = (0:nfft/2-1)*Fs/nfft;
ff1 = fft(S,nfft);
ff2 = fft(R,nfft);
% Take the magnitude
F1 = abs(ff1);
F2 = abs(ff2);
% plot signals
figure();
plot(freq,mF1); hold on
plot(freq,mF2);
title('Power Spectrum');
xlabel('Frequency')
ylabel('Power');
However, then all I have tried does not work properly:
% Subtract the reference from signal
M = F1-F2;
S_final = ifft(M);
When the signal gets back transformed it does not look like as I expected. The residual signal should be a Gaussian with some left over noise.
I would be absolutely great to help me with this issue!
Kind regards Tobias
1 Comment
Answers (1)
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!