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 Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by