Chapter 4
Loop Statements
Contents
Key Terms
looping statements
counted loops
conditional loops
action
iterate
loop or iterator variable
running sum
running product
factorial
preallocate
echo printing
nested loop
outer loop
inner loop
infinite loop
counting
error-checking
Consider the problem of calculating the area of a circle with a radius of 0.3 centimeters. A MATLAB® program certainly is not needed to do that; you'd use your calculator instead, and punch in π * 0.32. However, if a table of circle areas is desired, for radii ranging from 0.1 centimeters to 100 centimeters in steps of 0.05 (e.g., 0.1, 0.15, 0.2, etc.), it would be very tedious to use a calculator and write it all down. ...
Get Matlab: A Practical Introduction to Programming and Problem Solving, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.