Impact location detection from accelerometer data
이전 댓글 표시
I have accelerometer data coming from a accelerometer sensor which is mounted on top of handle of a cricket bat, I have played some shots some are missed and some hit, now I want to detect which shots are missed shots and which shots are hit shots. So how I can detect impact location or collide between cricket bat and ball. I guess there should be some algorithm or procedures by which we can get clue of impact location. Do matlab provide any script for it or how I can get help regarding this.
댓글 수: 5
Dyuman Joshi
2024년 3월 1일
How is the data stored? In which format?
How should the data be interpreted?
It would be better if you would share all the necessary details and information, which would aid us in providing suggestions/solutions accordingly.
Mathieu NOE
2024년 3월 1일
you can probaly distinguish based on amplitude and duration
would of course be nice to hace access to the data
xubyr
2024년 3월 1일
Mathieu NOE
2024년 3월 4일
hello again
can you comment your graph and describes what you habe done to generate that data ? we needto make the correlation between the graph and the events
xubyr
2024년 3월 8일
답변 (1개)
Mathieu NOE
2024년 3월 8일
편집: Mathieu NOE
2024년 3월 8일
hello
so this would be my suggestion
I hope my conclusion is not completely wrong !
At the end it seems I can clearly see 3 sharp and high amplitude peaks (above 5 g's ) corresponding to good hits; the other minor peaks are either missed hits or you shaking the baseball

code :
filename = "data1.csv";
data = importfile(filename);
% data = readtable('data1.csv') ; %
% data format :
% x,"y","z","timestamp"
% 0.10,"-1.69","9.85","14:58:30:267"
x = data.x;
y = data.y;
z = data.z;
timestamp = data.timestamp;
tmp = split(timestamp,':');
h = str2double(tmp(:,1)); % h column
m = str2double(tmp(:,2)); % m column
s = str2double(tmp(:,3)); % s column
ms = str2double(tmp(:,4)); % ms column
ts = h*3600 + m*60 + s + ms/1e3; % time in seconds
ts = ts - ts(1);
% plot(diff(ts)) ; % Nb the non constant sampling interval
% resample the data on a constant time interval time vector
tt = linspace(ts(1),ts(end),numel(ts));
x = interp1(ts,x,tt);
y = interp1(ts,y,tt);
z = interp1(ts,z,tt);
dt = mean(diff(tt));
Fs = 1/dt;
figure(1)
plot(tt,x,tt,y,tt,z);
legend('x','y','z')
% some high pass filtering to remove DC / low frequency signals
flow = 1;
[b,a] = butter(2,flow*2/Fs,'high');
xf = filtfilt(b,a,x);
yf = filtfilt(b,a,y);
zf = filtfilt(b,a,z);
figure(2)
plot(tt,yf,tt,zf);
legend('y','z')
figure(3)
% combine x,y,z signals into one rms signal
% see x direction contribution is neglectable , we can focus on y and z
% components only
rms_xyz = sqrt(xf.^2 + yf.^2 + zf.^2);
rms_yz = sqrt(yf.^2 + zf.^2);
plot(tt,rms_yz,tt,rms_xyz);
title('RMS (X) Y and Z acceleration');
xlabel('time (s)');
ylabel('amplitude (g)');
legend('rms(yz)','rms(xyz)')
댓글 수: 3
Mathieu NOE
2024년 3월 25일
hello
so have you solved your problem ?
xubyr
2024년 4월 5일
Mathieu NOE
2024년 4월 5일
hello again
do you have access to matlab ? if yes , and if you are new to it , I would suggest to look at some tutorials :
all the best
카테고리
도움말 센터 및 File Exchange에서 RESTful API에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!