Practical 2

Variables, Script M-files and Graphing

1. Understand the purpose of variables and how to create variables

2. Write a script M-File (a list of MATLAB commands, saved in a file) with an emphasis on using appropriate comments

3. Learn how to plot a graph

  1. Plot a graph of a straight line with fixed start and end points
  2. Plot a graph of a straight line with variable start and end points
  3. Plot a graph with two lines
  4. Use key plotting options including setting the title and axis.

 

Working through this Practical

Go through this practical at your own pace and learn about the MATLAB environment in more detail.

  • The exercises are indented and on separate pages with shaded areas. Do these!
  • Ask your MATLAB eTutor if you have any questions or need advice using the Practical's Forum
  • MATLAB code will always be denoted by the Courier font.
  • An arrow > at the start of the line in an exercise indicates an activity for you to complete.
  • Use the arrows on the top right and bottom right of this display to move between pages, or select a page using the left hand navigation pane.
  • You can also print this resource as a single document (using the print icon in 1.9 or the Admin section in 2.5/2.6).

Please submit your responses to the activities within this practical for formative feedback from your MATLAB eTutor. This word document template can be used to prepare your responses for submission.