๐Ÿ“˜ Lesson 4 of 6 ยท Computational Mathematics

๐Ÿ’ป MATLAB Basics

MATLAB is a specialized programming environment built specifically for numerical computing and matrix operations โ€” long a standard tool in engineering, science, and applied mathematics.

Course progress: 67%

01 Key Concepts

MATLAB's Core Idea

Everything in MATLAB is treated as a matrix (even a single number is a 1x1 matrix), making it especially natural for linear algebra and numerical work.

Creating Matrices

Matrices are created with square brackets, semicolons separating rows: A = [1 2; 3 4] creates a 2x2 matrix.

Basic Matrix Operations

A + B and A * B work directly on matrices; A' computes the transpose; inv(A) computes the inverse.

Vectors and Ranges

A range like 1:5 creates the vector [1 2 3 4 5]; 1:2:10 creates [1 3 5 7 9], stepping by 2.

Built-in Functions

MATLAB includes many built-in mathematical functions like sqrt(), sin(), det(), and eig() (for eigenvalues), applied directly to matrices.

02 Key Formulas

03 Solved Examples

Example 1 In MATLAB, what does the command 1:5 produce?
  1. This creates a range (row vector) from 1 to 5, incrementing by 1 by default.
Answer: [1 2 3 4 5]
Example 2 In MATLAB, what does A' do if A = [1 2; 3 4]?
  1. The apostrophe computes the transpose, swapping rows and columns.
  2. Row 1 (1,2) becomes column 1; row 2 (3,4) becomes column 2.
Answer: [1 3; 2 4]
Example 3 In MATLAB, what does det(A) return for A = [2 0; 0 3]?
  1. Apply the 2x2 determinant formula: (2*3)-(0*0).
Answer: 6

04 Practice Questions

1What does 1:2:9 produce in MATLAB?
[1 3 5 7 9]
2What does A' compute?
The transpose of matrix A
3What function computes a matrix's inverse?
inv()
4What symbol separates rows when defining a matrix in MATLAB?
A semicolon (;)
5What does eig(A) compute?
The eigenvalues of matrix A

๐Ÿ“„ MATLAB Basics โ€” Downloadable Worksheet

10 questions with a full answer key. Grab the PDF to print, or try the interactive version in your browser.