Lab 27

Application Data, Finding Objects and Mouse Selection

CS211 Lab Policy:

Instructions:

For this lab you will create and submit the program Lab27() saved in the file lab27.m. This program will plot 3 separate curves in a figure window and then let the user select which one is "labeled" and highlighted. Your Lab27() program should have the following behavior:

Your program should perform the following tasks:

  1. Clear the command window.
     
  2. For x values in the range [-4pi, 4pi], plot the curves sin(x), 2sin(2x), and x(sin(x)) using 3 separate plot() function calls. (Use hold('on') to keep the plots in the same axes.) Capture the handle to each line object and store each handle in a unique variable.
     
  3. Initialize a variable called Key to a single space (' ').
       
  4. Create a while loop that executes as long as Key is not equal to a 'q'. Perform the following tasks for each iteration of the loop:
     
  5. Close the figure and exit the program. (This happens after the while loop exits.)

Turn-in:

Submit your Lab27.m file.