Lecture 2-25

Lecture 2-25 - execution-The syntax is nearly identical to...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
February 25, 2008 Looping Structures: “While” Loops Exam 1:  March 10   for loops, while loops, vector/matrix operations… Conditional loops: while loops Execute until specified condition is false - E.g. While the error is unacceptable, refine the calculations to improve accuracy. Replaces indefinite amount of redundant code Indefinite loops while [logical expression] % executable code end - The variable used in the logical expression of the while loops must be initialized prior to 
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: execution.-The syntax is nearly identical to an if-statement-Variable in logical expression must be changed in code otherwise it will never end. a=1; while a<10 disp(‘a<10’) a=a+1; end Using “greater than” for the idea of until while error >= 0.01 % calculate another iteration of % the square root % recalculate error end ICA on square root Don’t check for equality of computed quantities p.103-106: ex1 on p.105...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online