Рет қаралды 18,908
In this video, I introduce you to updating the value of a scalar variable and using a counter variable inside of a while loop. To explain this concept, we will take a look at an example problem where we determine how long it will take to double an initial account balance based on a specified annual rate of return. First, we'll take a look at the problem statement. Then, I'll walk you through a flow chart of the problem to visualize the use of a counter variable. Finally, we'll solve the problem in MATLAB.
A while loop is a loop structure for repeating a calculation until a specified condition is met. While loops are present in most programming languages and environments.
This is Part 2 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 3 introduces the concept of storing the value of a loop variable inside of an array using an index variable. Link to Part 3: • 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.