Zero out sensor drift

조회 수: 10 (최근 30일)
Peter Schmitt
Peter Schmitt 2021년 8월 18일
댓글: Peter Schmitt 2021년 8월 18일
I am trying to write some signal processing code and am noticing some load cell drift over time. I feel like I should be able to take the dft, throw out the zero frequency term, then take the inverse dft of the signal to account for this. Another way of saying this is can I use the fftshift command for the y axis (of a load vs. time signal) instead of the x axis?

답변 (2개)

Walter Roberson
Walter Roberson 2021년 8월 18일
Taking the dft, throwing out the zero frequency, and then taking the inverse dft, is equivalent (to within round-off error) to subtracting mean() of the signal from the original signal -- unless, that is, your number of points for the fft or ifft is not the same as the original number of points.
N = 100;
t = 1 : N;
A = randn(1,N);
B = A - mean(A);
Af = fft(A);
Af(1) = 0;
Arec = ifft(Af);
max(abs(B - Arec))
ans = 6.6613e-16
plot(t, B, '-k', t, Arec, 'b.--');
legend({'A minus mean', 'reconstructed via ifft'})
You cannot see the black line (A minus mean) because the reconstructed line (zero fft bin) is identical to within round-off.
  댓글 수: 2
Peter Schmitt
Peter Schmitt 2021년 8월 18일
Thanks. Is this ultimately the same as the detrend function?
loadydetrend = detrend(loady,0)
Plotting both yields the following
Peter Schmitt
Peter Schmitt 2021년 8월 18일

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


Star Strider
Star Strider 2021년 8월 18일
If you have R2018a or later, use the highpass function to eliminate both the d-c offset and any low-frequency baseline drift. Ideally, take the fft of the signal first to see what the best cutoff frequency is, and also to determine if there are signal components of sufficiently low frequency that filtering would not be appropriate, since it could eliminate parts of them. In that instance the detrend function would be the best option.
.

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by