Syntax a while loop

조회 수: 3 (최근 30일)
Philosophaie
Philosophaie 2015년 8월 28일
답변: Walter Roberson 2015년 8월 28일
I am not sure I have the syntax right on my while loop: And I am taking the absolute value with the abs command.
EA1 = pi / 4;
diff = 1;
while (abs(diff) > 0.000001)
diff = (EA1 - e * sin(EA1) - MA) / (1 + e * cos(EA1));
EA1 = EA1 + diff;
end

답변 (1개)

Walter Roberson
Walter Roberson 2015년 8월 28일
That syntax is fine. You do not need the () around the condition but it does not hurt.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by