I am trying to determine the angular acceleration by applying the central difference technique?

5 ビュー (過去 30 日間)
I am trying to applied the central difference technique formula into my code but I am having trouble with the output. I am trying to determine the angular acceleration of by using the knee angle. I need to plot my ang_acc vs time . I am also using this formula: (x_(i+2)-2x_i+x_(i-2))/(4∆t^2 )
fs = 69.9;
t = [1/fs:1/fs:length(ankle)/fs];
fc = [.1:.1:(fs/2)-.1]';
n = length(fs);
t=106;
%% Step 1: Calculate Knee Angle
% hip -knee represent the end points of the thigh segment angle
%fibula-ankle represent the end points of the leg segment angle
theta21_thigh = atan2(hip(:,2)-knee(:,2),hip(:,1)-knee(:,1));
theta43_leg = atan2(fibula(:,2)-ankle(:,2),fibula(:,1)-ankle(:,1));
theta_knee = theta21_thigh - theta43_leg;
%% Step 2: Angular acceleration of the knee (central difference):
angular_acc = ((theta_knee(3:end))-(2*theta_knee)+(theta_knee(1:end-2))) ./(4*(106).^2);
  2 件のコメント
Sindar
Sindar 2020 年 9 月 28 日
is it throwing an error?
may be as simple as:
angular_acc = ((theta_knee(3:end))-(2*theta_knee(2:end-1))+(theta_knee(1:end-2))) ./(4*(106).^2);
(if you want the first and last point using forward/backward difference, you could just define those separately)

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

採用された回答

Nagasai Bharat
Nagasai Bharat 2020 年 10 月 1 日
Hi,
The error is due to the difference in the sizes of the operands i.e., knee_angle has a size different from knee_angle(1:end-2) and knee_angle(3:end).
Please look into the dimensions to eliminate the error.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometric Geodesy についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by