フィルターのクリア

How to make a loop correctly in stages

1 回表示 (過去 30 日間)
Emilia
Emilia 2022 年 7 月 28 日
コメント済み: Image Analyst 2022 年 7 月 28 日
Hello,
I'm trying to place these numerical values in the steps of a loop and it didn't turn out well, the software doesn't pick it up. Thanks for the helpers
alpha=120;
theta=90;
R=40;
S1=20;
S2=15;
r=(R/sqrt(2));
X_e=S1+r*sqrt(2)*sind(alpha)+r*sqrt(2)*sind(alpha+theta); %Direct kinematics formula in the x axis
Y_e=S2+r*sqrt(2)*cosd(alpha)+r*sqrt(2)*cosd(alpha+theta); %Direct kinematics formula in the y axis
phi_e=alpha+theta; %Direct kinematics formula in the angle axis
if alpha>160 && theta>110 && R>50 && S1>30 && S2>40
error('One of the entered numbers is not within range, please re-type normal numeric values.') %Error message
else
eqn = sind(alpha)*sind(alpha+theta)+sind(alpha+theta)*sind(alpha+theta)+cosd(alpha)*cosd(alpha+theta)+cosd(alpha+theta)*cosd(alpha+theta);
if eqn==0
sprintf('In this determinant matrix equation with the %d and %f values there are no singular states.',alpha,theta);
else
sprintf('In this determinant matrix equation with the values %d and %f there are singular states .',alpha,theta);
end
end

採用された回答

Walter Roberson
Walter Roberson 2022 年 7 月 28 日
Use fprintf instead of sprintf
  4 件のコメント
Emilia
Emilia 2022 年 7 月 28 日
It works well, Thank you! :)
Image Analyst
Image Analyst 2022 年 7 月 28 日
@Emilia Then please click the "Accept this answer" link to award @Walter Roberson "reputation points". Thanks in advance. 🙂

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by