Converting Accelerometer Data to Displacement
Show older comments
Hello,
We are trying to get displacement data in the time domain from our 3-axis accelerometer data. Is there a way to do this using the inverse fourier transform? This is what we have so far:
num = xlsread(filename);
num = num(1:2:end,:); % Eliminate ?NaN? Values
num(:,1) = num(:,1)*1E-3; % Convert Milliseconds To Seconds
Fs = 1/mean(diff(num(:,1))); % Sampling Frequency (Convert Milliseconds To Seconds)
Fn = Fs/2; % Nyquist Frequency
Tr = linspace(num(1,1), num(1,end), size(num,1)); % Time Vector (Regular Samples)
Dr = resample(num(:,2:end), Tr); % Resample To Constant Sampling Interval
Dr_mc = Dr - mean(Dr,1); % Subtract Mean
FDr_mc = fft(Dr_mc, [], 1);
N1 = size(num,1);
N = 2^(nextpow2(N1)+3);
FDr_mc = fft(Dr_mc, N); % Fourier Transform
% Fourier Transform
Fv = linspace(0, 1, fix(size(FDr_mc,1)/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
Answers (0)
Categories
Find more on Fast Fourier Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!