Filter löschen
Filter löschen

Syntax a while loop

2 Ansichten (letzte 30 Tage)
Philosophaie
Philosophaie am 28 Aug. 2015
Beantwortet: Walter Roberson am 28 Aug. 2015
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

Antworten (1)

Walter Roberson
Walter Roberson am 28 Aug. 2015
That syntax is fine. You do not need the () around the condition but it does not hurt.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by