MATLAB: Subtract the average time value by a signal

fft

Hello everyone, I performed a FFT of an accelerometric signal and I found a peak at 0 Hz in the abs of the FFT. In order to remove this nonsense I have to create the temporal average of the original signal (integral of the signal over time, divided by the time) and then I have to subtract it from the original signal. How can I perform this task? Thamk you very much.

Best Answer

Why not just zero that component of the fft? You will get the same result.
To get 0 in the 0 Hz bin, you should not be performing a temporal average in the manner you indicate. Instead for a single channel signal you should use
new_signal = signal - mean(signal);
This will differ from trapz(signal)/length(signal) by the weighting given to the first and last datapoint. To clarify, mathematically, the first bin output by fft() is the unweighted sum of the signal.