Converting acceleration data to displacement data using FFT results in Zero-drift
I have a (n x 1) vector containing acceleration data from a sensor and I am trying to obtain the displacement by:
performing an FFT
Convert acceleration to displacement in the frequency domain by dividing by -omega^2
performing an IFFT to get back to the time domain.
The idea is to make a conversion which doesn’t result in any Zero-drift, but all my attempts so far result in the oscillation being superimposed on a very low frequency wave (See figure attached), and I can’t tell where this low frequency oscillation is coming from. The result should be a near sinusoidal wave centred around zero.
Below is a (slightly modified) snippet from my code. The sensor data (Ch5) is attached as a .mat file.
Tinterval = 0.000625;
Length = length(Ch5);
SamplingFrequency = 1/Tinterval;
Frequency = SamplingFrequency*(0:Length-1)/Length;
Omega = 2*pi*Frequency;
ConversionFactor = -(Omega.^2).’;
ConversionFactor(1,:) = 1; %To avoid dividing by zero
% Base Data
RawData = Ch5;
Data = RawData – mean(RawData);
FourierTransform = fft(Data);
Y_accel_base = ifft(FourierTransform).’;
dY_base = abs(ifft(FourierTransform./ConversionFactor)).’;I have a (n x 1) vector containing acceleration data from a sensor and I am trying to obtain the displacement by:
performing an FFT
Convert acceleration to displacement in the frequency domain by dividing by -omega^2
performing an IFFT to get back to the time domain.
The idea is to make a conversion which doesn’t result in any Zero-drift, but all my attempts so far result in the oscillation being superimposed on a very low frequency wave (See figure attached), and I can’t tell where this low frequency oscillation is coming from. The result should be a near sinusoidal wave centred around zero.
Below is a (slightly modified) snippet from my code. The sensor data (Ch5) is attached as a .mat file.
Tinterval = 0.000625;
Length = length(Ch5);
SamplingFrequency = 1/Tinterval;
Frequency = SamplingFrequency*(0:Length-1)/Length;
Omega = 2*pi*Frequency;
ConversionFactor = -(Omega.^2).’;
ConversionFactor(1,:) = 1; %To avoid dividing by zero
% Base Data
RawData = Ch5;
Data = RawData – mean(RawData);
FourierTransform = fft(Data);
Y_accel_base = ifft(FourierTransform).’;
dY_base = abs(ifft(FourierTransform./ConversionFactor)).’; I have a (n x 1) vector containing acceleration data from a sensor and I am trying to obtain the displacement by:
performing an FFT
Convert acceleration to displacement in the frequency domain by dividing by -omega^2
performing an IFFT to get back to the time domain.
The idea is to make a conversion which doesn’t result in any Zero-drift, but all my attempts so far result in the oscillation being superimposed on a very low frequency wave (See figure attached), and I can’t tell where this low frequency oscillation is coming from. The result should be a near sinusoidal wave centred around zero.
Below is a (slightly modified) snippet from my code. The sensor data (Ch5) is attached as a .mat file.
Tinterval = 0.000625;
Length = length(Ch5);
SamplingFrequency = 1/Tinterval;
Frequency = SamplingFrequency*(0:Length-1)/Length;
Omega = 2*pi*Frequency;
ConversionFactor = -(Omega.^2).’;
ConversionFactor(1,:) = 1; %To avoid dividing by zero
% Base Data
RawData = Ch5;
Data = RawData – mean(RawData);
FourierTransform = fft(Data);
Y_accel_base = ifft(FourierTransform).’;
dY_base = abs(ifft(FourierTransform./ConversionFactor)).’; fft, sensor, ifft, convert, velocity, acceleration, zero-drift, array MATLAB Answers — New Questions