# how to do? Find the starting and ending points of the exercise on the graph

6 views (last 30 days)
JUNY on 29 Nov 2023
Commented: Angelo Yeo on 30 Nov 2023
I found the speed by integrating the acceleration data using the IMU sensor. Low-pass filters were applied to detrend and noise cancellation due to drift.
Now I want to get something to mark when the movement is over, what should I do?
I saw the video I filmed for motion capture, and the part that I marked was the moment the movement ended, and when I repeated the same movement, it all came out like that
for yourinformation
%% Data preprocessing
% --- left---
timestamp_left = T_left.uni_time(2:end);
time_left = timestamp_left;
time_left = (timestamp_left-timestamp_left(1))/1000;
xacc_left = T_left.("watch_acc.x")(2:end);
yacc_left = T_left.("watch_acc.y")(2:end);
zacc_left = T_left.("watch_acc.z")(2:end);
%% Offset correction and Filtering
% detrend_vectorsum
acc_x_detrendedL = detrend(xacc_left, 'linear');
acc_y_detrendedL = detrend(yacc_left, 'linear');
acc_z_detrendedL = detrend(zacc_left, 'linear');
vectorsum_acc_deL = sqrt(acc_z_detrendedL.^2+acc_x_detrendedL.^2+acc_y_detrendedL.^2);
vectorsum_accL = sqrt(acc_z_detrendedL.^2+acc_x_detrendedL.^2+acc_y_detrendedL.^2);
% lowpass_vectorsum
cutoff_frequency = 40; % 저주파 통과 필터의 컷오프 주파수 설정
filtered_acc_xL = lowpass(acc_x_detrendedL, cutoff_frequency, 100);
filtered_acc_yL = lowpass(acc_y_detrendedL, cutoff_frequency, 100);
filtered_acc_zL = lowpass(acc_z_detrendedL, cutoff_frequency, 100);
% y_axi_velocity
velocity_y_integralL = getvelocity(filtered_acc_yL, time_left);
% graph
figure;
% Acc graph
subplot(3, 1, 1);
hold on;
plot(time_left, vectorsum_accL,'r-','DisplayName','Left')
title('Original Acc_y')
xlabel('Time (s)')
ylabel('Acc')
hold off;
% use(detrend_acceleration)
subplot(3, 1, 2);
hold on;
plot(time_left, vectorsum_acc_deL, 'r-','DisplayName','Left')
title('Detrended Acc_y')
xlabel('Time (s)')
ylabel('Acc')
hold off;
% use(detrend and lowpass_velocity)
subplot(3, 1, 3);
hold on;
plot(time_left, velocity_y_integralL, 'r-','DisplayName','Left')
title('Y');
xlabel('Time (s)')
ylabel('velocity')
hold off;
figure();
plot(time_left, velocity_y_integralL, 'r-','DisplayName','Left');
hold on;
title('vectorsum')
*getvelocity is..
function v = getvelocity(acc, time)
v = zeros(1, length(acc));
for i = 1:length(acc)-1
dt = time(i+1) - time(i);
% numerical integration
v(i+1) = v(i)+0.5*dt*(acc(i) + acc(i+1));
end
end
##### 3 CommentsShow 1 older commentHide 1 older comment
JUNY on 30 Nov 2023
The start point of the movement is considered to be the first time when it increases or decreases rapidly, and the end point of the movement is to be considered the first time when the section begins to maintain a constant straight line after the last time
I need to find the start and end times of their movements with a lot of similar files. However, I can't use the method of finding using the threshold because the threshold values of the certain sections indicated by the files are all different due to drift..
Angelo Yeo on 30 Nov 2023
It's hard to "imagine" what your pain point is solely based on your description. Why don't you show how "different" the drift effects are across "files"? You can hardly find solutions without knowing pain points.

### Categories

Find more on Audio and Video Data 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!