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

6 views (last 30 days)

Show older comments

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

Can you help me.. please...

for yourinformation

%% Data preprocessing

% --- left---

T_left = readtable('DLT10.csv', 'VariableNamingRule', 'preserve');

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 Comments

Angelo Yeo
on 30 Nov 2023

### Answers (0)

### See Also

### Categories

### Products

### Community Treasure Hunt

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

Start Hunting!