필터 지우기
필터 지우기

The results of the plots does not match the actual ones

조회 수: 3 (최근 30일)
Abdulrahman Alhassan
Abdulrahman Alhassan 2024년 4월 29일
댓글: Star Strider 2024년 4월 29일
Hello everyone,
I am trying to plot a simple kinematics function. I did it first in Excel and the plots were corrects however when I transfered problem into Matlab, I got different results. Below are the function, true plots from excel and results from the code:
The matlab code and the plots are shown below:
L_BC = 430; % mm
L_CA = 900; % mm
L_AA_prime = 100; % mm
theta_Anchor_range = deg2rad(linspace(127.2, 187.46, 1000));
L_AB = sqrt((L_AA_prime^2)+(L_BC^2)+(L_CA^2)+(2*L_BC*(L_CA*sin(theta_Anchor_range+pi)))-L_AA_prime*cos(pi+theta_Anchor_range));
L_Stroke = L_AB - 580;
figure;
plot(rad2deg(theta_Anchor_range), L_Stroke);
xlabel('Theta Anchor (degrees)');
ylabel('L_Stroke (mm)');
title('Variation of L_AB with Theta BC');
grid on;
theta_AB = atan((L_CA+(L_BC*sin(pi+theta_Anchor_range))./(L_BC*cos(pi+theta_Anchor_range)-L_AA_prime)));
figure;
plot(rad2deg(theta_Anchor_range), rad2deg(theta_AB));
xlabel('Theta BC (degrees)');
ylabel('Theta AB (deg)');
The variation of length have the same phenomena however it does not start from zero.
Your support is highly appreciated.

채택된 답변

Star Strider
Star Strider 2024년 4월 29일
편집: Star Strider 2024년 4월 29일
There may have been a problem converting degrees to radian measure, however that is not required in MATLAB. Use trigonometric functions with the ‘d’ (sind, cosd, atan2d) to use degrees without having to convert them. Additionally, I use atan2d here, rather than atand. It seems to give the appropriate results.
Try this —
L_BC = 430; % mm
L_CA = 900; % mm
L_AA_prime = 100; % mm
theta_Anchor_range = linspace(127.2, 187.46, 1000);
L_AB = sqrt((L_AA_prime^2)+(L_BC^2)+(L_CA^2)+(2*L_BC*(L_CA*sind(theta_Anchor_range+180)))-L_AA_prime*cosd(theta_Anchor_range));
L_Stroke = L_AB - 580;
figure;
plot(theta_Anchor_range, L_Stroke);
xlabel('Theta Anchor (degrees)');
ylabel('L_Stroke (mm)');
title('Variation of L_AB with Theta BC');
grid on;
theta_AB = atan2d((L_CA+L_BC*sind(180+theta_Anchor_range)),(L_BC*cosd(180+theta_Anchor_range)-L_AA_prime));
figure;
plot(theta_Anchor_range, theta_AB);
grid
xlabel('Theta BC (degrees)');
ylabel('Theta AB (deg)');
% axis('equal')
EDIT — Corrected typographical errors.
.
  댓글 수: 4
Abdulrahman Alhassan
Abdulrahman Alhassan 2024년 4월 29일
Will do that.
Thank you for your efforts.
Star Strider
Star Strider 2024년 4월 29일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by