ENGR 101 Lecture Notes - Lecture 15: Matlab
Document Summary
At this point, we have discussed sequence, selection, and basic iteration (the while construct) Recall: iteration is the repetitive execution of a group of instructions as long as some condition it met. There are two formal iteration constructs in matlab that we will cover: However, often the most efficient way to execute a loop in matlab is to vectorize the operation. Analyzing loops loops provide the means to reach the solution to a problem by successive approximation. Start off with an answer and as it goes on you get closer and closer to your final answer. Example : power x^y function z = power(x,y) %compute x to the y power z=1; n=0; while n