Double integration of the acceleration signals to obtain displacment signals

105 ビュー (過去 30 日間)
UTS
UTS 2014 年 12 月 17 日
コメント済み: Samuel Hudson 2022 年 7 月 14 日
Hi,
In order to obtain the displacement signals from the acceleration data, The following steps are used to convert the acceleration data to achieve the displacement values:
1- The acceleration signals are filtered [High pass filter]
2- The cumtrapz is applied to integrate the displacement to obtain the velocity
3- The velocity signals are filtered [High pass filter]
4- Finally, the filtered signals of velocity is integrated to get the displacement signals.
The concern is still about the correct methods and the accuracy of the results which are obtained.
Please have look at the Matlab Program as stated below; If there any comments and contribution regarding the proposed methodology please do not hesitate to shear us your experience, Thank you
%%accelerations are integrated twice to produce displacements
clear all
close all
clc
time = load('D:\Users\Desktop\time.txt');
acc = load('D:\Users\Desktop\data.txt');
figure
plot(time,acc)
xlabel('Time (sec)')
ylabel('Acceleration (mm/sec^2)')
%%Design High Pass Filter
fs = 8000; % Sampling Rate
fc = 0.1/30; % Cut off Frequency
order = 6; % 6th Order Filter
%%Filter Acceleration Signals
[b1 a1] = butter(order,fc,'high');
accf=filtfilt(b1,a1,acc);
figure (2)
plot(time,accf,'r'); hold on
plot(time,acc)
xlabel('Time (sec)')
ylabel('Acceleration (mm/sec^2)')
%%First Integration (Acceleration - Veloicty)
velocity=cumtrapz(time,accf);
figure (3)
plot(time,velocity)
xlabel('Time (sec)')
ylabel('Velocity (mm/sec)')
%%Filter Veloicty Signals
[b2 a2] = butter(order,fc,'high');
velf = filtfilt(b2,a2,velocity);
%%Second Integration (Velocity - Displacement)
Displacement=cumtrapz(time, velf);
figure(4)
plot(time,Displacement)
xlabel('Time (sec)')
ylabel('Displacement (mm)')
  6 件のコメント
Jose Sosa Lopez
Jose Sosa Lopez 2020 年 10 月 22 日
Thank you, I'll use it
Samuel Hudson
Samuel Hudson 2022 年 7 月 14 日
Would you be willing to provide a sample of data that works in this code?

サインインしてコメントする。

回答 (7 件)

UTS
UTS 2014 年 12 月 18 日
Any comments, Thanks
  1 件のコメント
Matthew Nijsten
Matthew Nijsten 2018 年 3 月 27 日
Hi there, so if i put an array of 2498x1 acceleration points into this code it will output me 2498x1 respective data points

サインインしてコメントする。


as k
as k 2016 年 4 月 3 日
Its working ıts working , Thank you so much my friend . Really saved my life today. I hope the sun may always shine upon your path.

as k
as k 2016 年 4 月 3 日
One more thing , we usually measure disp. in mm and those calculation above give us result ,generally, in meters so this is just a reminder.

Hasan Siddiqui
Hasan Siddiqui 2016 年 7 月 14 日
What units does the original accelerometer data need to be in originally? I have data collected from an arduino that is a 10 bit voltage reading from 0-1023. Does it need to be converted to the range of the accelerometer in gs first (-3g to 3g)?

Adi Negoro
Adi Negoro 2017 年 4 月 24 日
I'm newbie,
how to understand the "fc=0.1/30; % Cut off Frequency"?
  7 件のコメント
Desmond Dunggat
Desmond Dunggat 2022 年 5 月 26 日
@Vincent den Ouden so actually the filter designed above is Butterworth filter is it? Not High Pass filter?
Vincent den Ouden
Vincent den Ouden 2022 年 5 月 26 日
the term butterworth says more something about the idea/characteristics behind the filter, and in the case of the butterworth the idea is to have the most flat frequency response possible in the passband (frequencies that you want). The filter itself can be lowpass/highpass or bandpass.

サインインしてコメントする。


Aashish Sah
Aashish Sah 2020 年 5 月 19 日
編集済み: Aashish Sah 2020 年 5 月 19 日
Hi,
I have one question regarding this code. I have acceleration data in terms of g, so I multiply by 9.8 to get in terms of ms^-2. The displacement should then be in terms of m. However, when I apply the filter to my acceleration data, it normalizes the data. For example, the max and min of raw acceleration data is [10.5, 9.6] ms^-2 and after I apply the filter I get [0.68 -0.56]. It seems that filtering process normalizes the raw data between -1 and 1.
This introduces an issue for me since I wish to compare the actual displacement from different accelerometer sensors.
Any suggestions?
  1 件のコメント
Broc Sommermeyer
Broc Sommermeyer 2020 年 11 月 15 日
This code is designed to measure the velocity and displacement that are a function of time dependent acceleration by applying the high pass filter to remove the constant gravity value of 1g. Fourier series representation of periodic signals would break down a(t) into a constant term and an infinite sum of sine and cosine terms. The filter removes the constant term and any sine and cosine terms that have a frequency lower than the cutoff frequency fc. If you want to look at the complete accelerometer data including gravity remove the filter from the code.

サインインしてコメントする。


Joven Chou
Joven Chou 2020 年 12 月 30 日
awesome codes

カテゴリ

Help Center および File ExchangeAnalog Filters についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by