Question: Loops can involve many repetitions, so printing during each pass through a loop is often impractical and undesirable. In some cases, a message or other
Loops can involve many repetitions, so printing during each pass through a loop is often impractical and undesirable. In some cases, a message or other cleanup work is done after the loop is finished.
Example Compute the average of a list of numbersThe expression x rand n creates a row vector of n pseudorandom numbers. The expression ssxi adds the ith element of x to the sum. As in Example an initial value of s must be assigned before the loop starts. The average value xbar can only be computed after the loop is finished.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
