Course Code:                 MATH 1194

Course Title:                  Introduction to Mathematical Software III - A Primer on MATLAB

Level:                             1

Semester:                       1, II      

No. of Credits:                 1

Pre-requisite(s):               Units 1 and 2 of CAPE Pure Mathematics or equivalent or

                                        Math 1125 (Maths for General Sciences II) or equivalent.

 

Course Rationale

 Mathematics is a powerful tool used for solving practical problems and is a highly creative field of study, combining logic and precision with intuition and imagination.  The ability to employ mathematical reasoning is a fundamental skill for any well-educated individual in the pure and applied sciences. 

Recent improvements in computing technology and mathematical software have inevitably led to a marriage of mathematics and computers.  Specialized software can be used to solve problems in differential equations, numerical analysis, calculus, mathematical modelling, and so forth.  As such, knowledge of mathematical software is a not only an asset but a necessity for contemporary mathematicians. 

This introductory level course is designed to serve as an introduction to MATLAB, which is a very powerful and sophisticated software package.  Unfortunately, most powerful packages tend to be somewhat intimidating to a beginner.  That is why this course exists – firstly to help the student build confidence when utilizing MATLAB, and ultimately in making the student become more proficient in the functionalities of MATLAB software and its programming language.  This knowledge will ultimately serve in creating well-rounded Mathematics students capable of tackling both modelling and numerical analysis work in high-level undergraduate and postgraduate courses. 

 

Course Description

MATLAB, which stands for Matrix Laboratory, is a software package for high-performance numerical computation and visualization.  It provides an interactive environment with hundreds of built-in functions for technical computation, graphics and animation, while providing easy extensibility with its own high-level programming language. 

This course prepares the student to understand and properly apply MATLAB in analyzing and solving problems without a previous knowledge of either MATLAB or computer programming.  It first introduces the student to the most useful and easily accessible features of MATLAB.  Students will be guided through the MATLAB environment and shown basic functionalities of the package such as the use of MATLAB as a calculator.  Online documentation and Help features will be delineated to the students, followed by interactive computation, including but not limited to matrices and vectors.  The use of built-in functions and a thorough study on plots, graphics, and animations will be performed.  The latter part of the course introduces the student to the programming language of MATLAB, particularly as it relates to the creation of user-designed functions.

Teaching will take place entirely in weekly interactive lab sessions where the emphasis will be on active learning. Assessment will be based on coursework examinations and several lab assignments

 

Learning Outcomes

Upon successful completion of this module, students will be able to:

  • Use MATLAB commands to perform simple calculations and analyze data.
  • Use MATLAB commands to make appropriate programming plots and use the MATLAB Figure Editor to modify those plots to include advanced components such as text comments, arrows and a legend.
  • Write a program in MATLAB following good programming practice and using: scalar and array operations, control structures and built-in math functions. 

Course Content

  • The MATLAB interface and its components.  The Command, Graphics and Edit Windows.
  • MATLAB as a calculator.
  • Output formats.
  • Creation of directories and saving files.
  • Online documentation and Help.
  • Matrices and Vectors
      1. Creation and manipulation of Matrices and Vectors.
      2. Difference between vectors and scalars.
      3. Indexing matrices and Matrix dimensions.
      4. Matrix multiplication versus element-wise multiplication.
      5. Performing fundamental linear algebra computations.
  • Use of built-in functions in MATLAB.
  • Array operations, relational operations and logical operations.
  • Elementary mathematical functions.
  • Manipulation of character strings.
  • Creating and using Inline functions.
  • Recording a session with the ‘diary’ command.
  • Plots and Graphics
      1. Use of plotting functions to generate 2-D and 3-D plots.
      2. Modifying plots using the Plot Editor.
      3. Specialized 2-D and 3-D plots.
      4. Overlay of plots using the ‘plot’, ‘hold’ or ‘line’ commands.
      5. Using the ‘subplot’ command to layout multiple graphs.
      6. Modification of viewing angles in 3-D plots.
      7. Creation of two-dimensional grid systems using the ‘meshgrid’ function.
      8. Saving graphs in various formats and printing of graphs.
      9. Image processing using MATLAB.
      10. Animation in MATLAB using ‘comet’ or ‘movie’ command.
  • Programming in MATLAB
      1. Difference between a function and a script.
      2. Labelling of script files.
      3. Elements of a function.
      4. Saving and executing a function either with or without explicit output.
      5. Evaluation of a function using the ‘feval’ command.
      6. Guidelines for writing good functions.
      7. Use of ellipsis for continuation.
      8. Global and local variables.
      9. Loops, branches and control flow.
      10. Interactive input: ‘Keyboard’, ‘Menu’ and ‘Pause’ commands.
      11. Program debugging.

Teaching Methodology

 Labs: One (1) computer lab session each week of two (2) hours.  Sessions will serve as an avenue for introducing MATLAB.

 

 Assessment

 Coursework – 100%

  • Two 1-hour coursework examinations  –  30%
    • Coursework #1 – 15% - 2 Questions

Practical Computer Lab Exam.

Questions will involve either interactive computation or the formulation and manipulation of plots.

  • Coursework #2 – 15% - 2 Questions

Practical Computer Lab Exam

Each question will involve writing a program in MATLAB to help solve a practical mathematical problem.

  • One 2-hour coursework examination  –  30%
  • Coursework #3 – 30% - 2 Sections

Practical/Theoretical Exam

This exam will consist of two sections and will test all principles covered in the course.  Section I will consist of Multiple Choice questions testing the student on correct MATLAB syntax and procedures.

Section II will consist of structured questions focusing on solving problems in MATLAB.

  • Six equally weighted take-home assignments – 40%

Students will be tested on principles learnt during the semester as delineated in the course calendar. 

  

Course Calendar

 

Week

Lecture Subjects

Assignments/Exams

 

1

Course Overview/Introduction

Introduction to MATLAB and the MATLAB Interface:   The MATLAB interface and its components.  The Command, Graphics and Edit Windows.   MATLAB as a calculator.  Output formats.   Creation of directories and saving files.   Online documentation and Help.

 

2

Matrices and Vectors:  Creation and manipulation of Matrices and Vectors.  Difference between vectors and scalars.  Indexing matrices and Matrix dimensions.  Matrix multiplication versus element-wise multiplication.  Performing fundamental linear algebra computations.

Assignment 1

3

Built-in Commands and logical functions:  Use of built-in functions in MATLAB.  Array operations, relational operations and logical operations.  Elementary mathematical functions.  Manipulation of character strings.  Creating and using Inline functions.  Recording a session with the ‘diary’ command.

 

4

2-D Graphics:  Use of plotting functions to generate 2-D plots.   Modifying plots using the Plot Editor.   Specialized 2-D plots.   Overlay of plots using the ‘plot’, ‘hold’ or ‘line’ commands.  Using the ‘subplot’ command to layout multiple graphs.  Creation of two-dimensional grid systems using the ‘meshgrid’ function.  Saving graphs in various formats and printing of graphs.           

Assignment 2

5

3-D Graphics:  Use of plotting functions to generate 3-D plots.  Modifying plots using the Plot Editor.  Specialized 3-D plots.  Modification of viewing angles in 3-D plots. 

Assignment 3

6

First Coursework Examination (15%)

 

7

Image Processing:  Manipulation of images in MATLAB using the ‘imread’ and ‘imshow’ commands.  Animation in MATLAB using ‘comet’ and ‘movie’ commands. 

Assignment 4

8

Programming in MATLAB: Difference between a function and a script.  Labelling of script files.  Elements of a function.  Saving and executing a function either with or without explicit output

 

9

Programming in MATLAB - Functions:  Evaluation of a function using the ‘feval’ command.  Guidelines for writing good functions.  Use of ellipsis for continuation.  Global and local variables. 

Assignment 5

10

Second Coursework Examination (15%)

 

11

Programming in MATLAB - Control Structures:  Loops, branches and control flow.

 

12

Interactive input: ‘Keyboard’, ‘Menu’ and ‘Pause’ commands.

Assignment 6

13

Third Coursework Examination (30%)

 

 

Required Reading

Essential Text

  • Rudra Pratap, Getting Started with MATLAB: Version 6: A Quick Introduction for Scientists and Engineers, Oxford University Press.