フィルターのクリア

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 Center および File ExchangeData 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