MATH 2370 Lecture Notes - Lecture 17: Matlab, Infinite Loop
Document Summary
Section 5. 2. 1 combining for loops with if statements. Write a function that will sort an input vector v of any length, containing real numbers. It will sort largest to smallest and output new sorted vector as v. Intro to programming with matlab page 1 v(n) etc. Initial/final index values - "inappropriate" values aren"t always errors. Condition is usually one or more logical comparisons. The loop will run as long as the condition is true and stop when the condition is false ex: sum=0 while sum<50 sum=sum+3 end sum. Final value is 51 because 48<50, so it will still add 3 but now that it is over 51 it will stop (first number before the loop stops) Compute for the largest n possible, i. e. , the terms eventually become too small for the computer to store - called underflow. At this point, matlab sets the number to 0. (smallest.