Zero out sensor drift

10 Ansichten (letzte 30 Tage)
Peter Schmitt
Peter Schmitt am 18 Aug. 2021
Kommentiert: Peter Schmitt am 18 Aug. 2021
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?

Antworten (2)

Walter Roberson
Walter Roberson am 18 Aug. 2021
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 Kommentare
Peter Schmitt
Peter Schmitt am 18 Aug. 2021
Thanks. Is this ultimately the same as the detrend function?
loadydetrend = detrend(loady,0)
Plotting both yields the following
Peter Schmitt
Peter Schmitt am 18 Aug. 2021

Melden Sie sich an, um zu kommentieren.


Star Strider
Star Strider am 18 Aug. 2021
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.
.

Kategorien

Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by