Рет қаралды 16,127
A while loop is a loop structure for repeating a calculation when the number of loop passes is not known in advance. In this video, we'll use a while loop to determine how long it will take to double an initial account balance based on a specified annual rate of return. Unlike in Part 2 (link below), we'll store the account balance inside of an array using an index variable. First, we'll take a look at the problem statement. Then, I'll walk you through a flow chart to visualize how to store the end-of-year balance in a specific element in an array through the use of an index variable. Finally, we'll solve the problem in MATLAB. While loops are present in most programming languages and environments.
This is Part 3 of a 4 Part Series on while Loops.
Part 1 introduces the basic structure of a while loop and demonstrates a loop pass. Link to Part 1: • MATLAB for Engineers -...
Part 2 expands upon the concept of updating the value of a scalar loop variable with each loop pass. Link to Part 2: • MATLAB for Engineers -...
Part 4 introduces the concept of combing loops and logic by nesting an if statement inside of a while loop. Link to Part 4: • MATLAB for Engineers -...
The background music in the intro and outro was written and produced by Michael J Calamas for the exclusive use of David Calamas.