I running the following if-loop:
sigmat=24;
n=1.5;
sigmam=20;
N=200;
si=sigmat/n;
if si>=sigmam
F=N/si;
end;
But after this script is run out I can not claim a value of F in command window (F should be equal 12,5). Where did I mistake in this script?

 채택된 답변

Star Strider
Star Strider 2015년 5월 16일
편집: Star Strider 2015년 5월 16일

0 개 추천

The problem is that ‘si’ is 16 and ‘sigmam’ is 20. The if condition always evaluates to false, and the if block never executes.
Also, if you want ‘F’ to output to the Command Window, remove the semicolon at the end of the line. The presence of the semicolon suppresses Command Window output:
F=N/si
----------
I like your avatar!

댓글 수: 3

Sergey Dukman
Sergey Dukman 2015년 5월 16일
Ok.
To evaluate F (when ‘si’ is 16 and ‘sigmam’ is 20), should I use while loop then?
Sergey
Sergey Dukman
Sergey Dukman 2015년 5월 16일
Sorry!
I got it now. I have to use opposite condition as si<=sigmam to define F.
thank you Sir!
Yours look also good :)
Star Strider
Star Strider 2015년 5월 16일
My pleasure!
Save the Polar Bears!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2015년 5월 16일

댓글:

2015년 5월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by