1. Introduction to a Row Vector

In MATLAB, a row vector is a 1D array of numbers arranged horizontally. It is essentially a matrix with one row and multiple columns. Elements are separated by spaces or commas.

Syntax: v = [1, 2, 3, 4]

Interactive Row Vector

1
2
3
4

2. Introduction to a Column Vector

A column vector is a 1D array arranged vertically, representing a matrix with multiple rows and a single column. In MATLAB, elements are separated by semicolons (;).

Syntax: v = [1; 2; 3; 4]

Interactive Vector Transpose

Click the button to transpose the row vector into a column vector.

1
2
3
4

3. What is Line Spacing (linspace)

The linspace function generates linearly spaced vectors. It is highly useful for creating points for plotting or generating coordinate arrays.

Syntax: linspace(start_value, end_value, number_of_points)

linspace(0, 10, 5)

4. Concept of Indexing

Indexing in MATLAB allows you to extract or modify specific elements in an array or matrix using their row and column coordinates. MATLAB uses 1-based indexing.

Syntax: A(row, column)

Interactive Indexing Grid

Click any cell to see its MATLAB index.

A(?, ?) = ?

5. Concept of Logical Indexing

Logical indexing provides a fast way to filter data. By applying a logical condition, MATLAB creates a binary mask (array of 1s and 0s) to extract elements that meet the criteria.

Syntax: A(A > 5)

Highlight Values > 5

6. Introduction to Matrices

A matrix is a two-dimensional rectangular array of numbers. MATLAB is specifically optimized for matrix operations (MATLAB stands for Matrix Laboratory).

Syntax: A = [1, 2; 3, 4] creates a 2×2 matrix.

7. Matrix Addition and Subtraction

Matrices must have the exact same dimensions to be added or subtracted. The operations are performed element-wise.

Interactive Matrix Arithmetic

5
8
3
6

+

1
2
1
4

=

6
10
4
10