필터 지우기
필터 지우기

Subtract the average time value by a signal

조회 수: 11 (최근 30일)
Guglielmo Giambartolomei
Guglielmo Giambartolomei 2016년 7월 11일
댓글: Walter Roberson 2016년 7월 11일
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.

채택된 답변

Walter Roberson
Walter Roberson 2016년 7월 11일
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.
  댓글 수: 2
Guglielmo Giambartolomei
Guglielmo Giambartolomei 2016년 7월 11일
Thank you Walter. Some clarification if possible: so I have to subtract the mean signale from the original signal (the simple mean)? I didn't understand your assertion "This will differ from trapz(signal)/length(signal) by the weighting given to the first and last datapoint". Thank You!
Walter Roberson
Walter Roberson 2016년 7월 11일
trapz(signal) = 1/4 * (2 * signal(1) + 4 * signal(2:end-1) + 2 * signal(end) ) = sum(signal(2:end-1)) + 1/2 * (signal(1) + signal(end)) = sum(signal) - 1/2 (signal(1) + signal(end))
So trapz(signal) is sum(signal) except with the first and last signals given half weight.
I mention trapz(signal) because it is one of the most common numeric integration techniques.
Yes, to have the first bin of fft(signal) come out as 0, use
fft_of_signal = fft(signal - mean(signal));
To within round-off error, this will be exactly the same as
fft_of_signal = fft(signal);
fft_of_signal(1) = 0;

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by