Info
此问题已关闭。 请重新打开它进行编辑或回答。
MATLAB :How to program with MATLAB
1 次查看(过去 30 天)
显示 更早的评论
When a>90°,the value of L is 9; when a<90°,the value of L is 90; MATLAB? :How to program with MATLAB
0 个评论
回答(2 个)
Star Strider
2015-3-7
One way:
L = @(a) [9*(a>90) + 90*(a<90) + 0*(a==90)];
L_test = L([45 135 90]);
0 个评论
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.
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!