Practical 4

For- and While- Loops, If-statements

  • Use sequence controls- for, while, if-else
  • Create a for- loop to repeatedly execute statements a fixed number of times.
  • Create a while- loop to execute commands as long as a certain condition is met.
  • Use relational and Boolean operators
  • Use if-else constructions to change the order of execution.
  • Understand the purpose of count variables.

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. Use this word document as a template to prepare your responses for submission.