I am trying to determine the angular acceleration by applying the central difference technique?
조회 수: 4 (최근 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
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
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!