Plotting Graphs

Exercise

> Create and run a script M-file called plotMe.m for the following command. Remember to add your comment headers at the top.

plot([1 3], [2 5])

Note: The graph will appear in a separate Figure Window named Figure 1 that is often hidden behind the main MATLAB window. Maximise it on your taskbar if it does not pop up.

> What does the graph look like? Verify which points of 1, 2, 3, 5 are -coordinates or -coordinates.

 

> Modify your plotMe script M-file to plot the functions and over the region of  by following these steps.

  1. Define the endpoints of as the two variables & .
  2. Define the endpoints of , as the two variables & , in terms of & .
  3. Change the plot command to:
    plot([x1 x2], [y1 y2])
  4. Run your file to check that your updated graph is correct.
  5. Define the endpoints of , as the two variables & , in terms of & .
  6. Change the plot command so that both lines are plotted on one graph as follows:
    plot([x1 x2], [y1 y2], [x1 x2], [z1 z2])
  7. Check that your updated graph is correct.