For loop in matlab4/1/2024 ![]() So x is equal to x= i 2 and as the value of I is now 4 so the square will become 16. Now our current value of i is 4 which is not greater than 4 the statement is false and now we assign a new value to x. Next we increment I by 2 so i now has a value of 4 and we begin our second loop pass. ![]() So that is the value assigned to x and that completes our first loop pass. Let’s take a look at a flow chart of our example which can help demonstrate each loop pass our loop variable i has an initial value of 2 and this initial value of I is not greater than our final value of 4 that statement is false and so we assign a value to x which is equal x= i 2 now as the value of I = 2 so the value of x will be equal to 4. In this case i is our loop variable i has an initial value of 2 an incremental or step value of 2 in a final or terminating value of 4 and for each value of I our statement is evaluated as x= i 2.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |