Info

この質問は閉じられています。 編集または回答するには再度開いてください。

MATLAB :How to program with MATLAB

1 回表示 (過去 30 日間)
Lan
Lan 2015 年 3 月 7 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
When a>90°,the value of L is 9; when a<90°,the value of L is 90; MATLAB? :How to program with MATLAB

回答 (2 件)

Star Strider
Star Strider 2015 年 3 月 7 日
One way:
L = @(a) [9*(a>90) + 90*(a<90) + 0*(a==90)];
L_test = L([45 135 90]);

James Tursa
James Tursa 2015 年 3 月 7 日
You should probably review the basics of MATLAB. E.g.,
As for your particular request, simply taking your words and forming them into pseudo-code:
When a>90°
the value of L is 9;
when a<90°,
the value of L is 90
Turning each line into MATLAB syntax yields:
if( a > 90 )
L = 9;
elseif( a < 90 )
L = 90;
end
Then note that you have not covered the case where a == 90 exactly.

この質問は閉じられています。

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by