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