MATLAB for Engineers - Introduction to for Loops (Part 2 of 4): Updating Variables Inside a Loop

Опубликовано: 28 Август 2026
на канале: Spartan Professor
58,734
1k

A for loop is a loop structure for repeating a calculation a pre-defined number of times. In this video, we'll use a for loop to evaluate a mathematical summation in MATLAB. In other words, we will use a for loop to calculate each term in a series solution, and then sum each term to evaluate the total. First, I'll introduce you to the problem statement. Then, I'll take you through a flow chart of the problem to visualize each loop pass. Finally, I'll walk you through the implementation of the for loop in MATLAB. If you are unfamiliar with for loops, I'd recommend watching Part 1 of the series (link below).

This is Part 2 of a 4 Part Series on for Loops.

Part 1 introduces the basic structure of a for loop and demonstrates a loop pass. Link to Part 1:    • MATLAB for Engineers - Introduction to for...  

Part 3 introduces array indexing, element-by-element operations, and storage of data inside of an array. Link to Part 3:    • MATLAB for Engineers - Introduction to for...  

Part 4 will introduce combining loops and logic by nesting the conditional statements if, elseif, and else inside of a loop. Link to Part 4:    • MATLAB for Engineers - Introduction to for...  

The background music in the intro and outro was written and produced by Michael J Calamas for the exclusive use of David Calamas.