Lab 7 focuses on Chapter 6 of Gilat. This is probably the most difficult lab since it involves programming (primarily conditional statements and loops, so it is IMPERATIVE that students plan this out as much as possible-waiting until the night before just about GUARANTEES that the team will NOT finish the lab in time! ***IMPORTANT GENERAL GUIDELINE*** When running commands inside loops and conditional statements, in general ALL output should be suppressed by placing a semicolon at the end of the line. This is ESPECIALLY important when creating large vectors/matrices (such as #33 with n=10,000)! Otherwise, their published pdf file will be HUGE and may even put them over memory quota (and will put them over print quota if they try to print it!) g5c6p212x10: (for/end loops) Students should define F(1)=0 and F(2)=1, then use a loop to create the next 18 values. The syntax for a loop is given on pp192-194. Note that the loop can start at any value (they will want to start with 3). If the students do not know what commands to put inside the loop, refer them to Example 2c) in the Stewart book (although they start with F(1)=1 and F(2)=1, the recursive definition is the same). g5c6p213x11: (for/end loops) Similar to the previous problem, but students should instead define F(1)=1, F(2)=1, and psi=1/F(1)+1/F(2). They will use the same commands inside the loop and add one more command (refer to the code inside the loop for Sample Problem 6-5(a) at the top of p195 for help). g5c6p213x12: (conditional statements) Ignore the "ask the user to enter the values..." since it makes publishing difficult. Students can just define a, b, and c in the file and run the program 3 times OR they can use a loop to automatically run the program 3 times and change the values each time (using if/elseiflelse/end statements as explained below). After computing D, use the if/elseif/else/end statements discussed on p187 of Gilat to determine the number of roots; if there are roots, use the quadratic formula to find them. As stated in the NOTE, display the text and roots using the disp command as illustrated in pp101-102. ***IMPORTANT-to test if D=0, they must use "==" instead of "=" as stated on p176*** g5c6p214x20: (loops, conditional statements) Students should start by defining r=1 (row 1 of the matrix they will create) and then use a loop (from 11 to 497 by 2 since only odd numbers in this domain are prime!). In the loop, students should test if the given number is prime AND the next number (i+2) is prime (remind them they ARE allowed to use the "isprime" command to test this). Refer to Sample Problem 6-6 on p196 for an example of using AND (&) and OR (|) in "if" statements. If the test is true, put both numbers in the current row of a matrix (TP(r,:)=[i i+2]; OR TP(r,1)=i; TP(r,2)=i+2;), then move to the next row (r=r+1;). After ending the conditional statement and loop, display the matrix. g5c6p218x33: (loops, if/elseif/else OR switch case) Define x(1)=0 and y(1)=0, then create a loop (n=1 to whichever top number used). Refer to p78 for generating a random number between 0 and 1. There are two ways to handle the selecting of the rule: METHOD 1: Use if/elseif/else. If the random number <= 1/3, use Rule 1. Else if the random number <= 2/3, use Rule 2. Else use Rule 3. METHOD 2: Define rule=ceil(rand*3) (see p16 for the ceil command). Then "rule" will either be 1, 2, or 3. Use a switch-case statement (pp189-191) on "rule". After ending the conditional statement/switch case and the loop, use the print command given in the problem to print the image. Let me know if you have any questions about this assignment.