O'Reilly logo

Essential MATLAB for Engineers and Scientists, 6th Edition by Daniel T. Valentine, Brian Hahn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8

Loops

Abstract

The objectives of this chapter are to enable you to learn to program (or code) determinate loops with for and indeterminate loops with while. The for statement is used to repeat a block of statements a fixed number of times. This type of structure, where the number of repetitions must be determined in advance, is called determinate repetition. However, it often happens that the condition to end a loop is only satisfied during the execution of the loop itself. Such a structure is called indeterminate. In this case a while loop should be useful. Both loop structures are described in this chapter.

Keywords

Repetitive computations and analysis; Loops; For (determinate) and while (indeterminate) loops

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required