operators-matrix

Programming

Matrix-specific operators. A' is conjugate transpose (ctranspose). A.' is non-conjugate transpose. A \ b solves the linear system Ax = b (equivalent to inv(A)*b but more numerically stable). Indexing: A(i,j) for element access, A(:,1) for entire column, A(end) for last element. Colon operator: start:end or start:step:end creates a range vector.

Syntax

A'
A.'
A \ b
A(i, j)
A(:, 1)
A(end)
1:10
1:0.5:10

Examples

A = [1 2; 3 4]; A'  % transpose
▶ Run
A = [1 2; 3 4]; b = [5; 6]; A \ b  % solve Ax = b
▶ Run
v = 1:5  % [1, 2, 3, 4, 5]
▶ Run
v = 0:0.25:1  % [0, 0.25, 0.5, 0.75, 1]
▶ Run
A = [10, 20, 30]; A(end)  % 30
▶ Run

See Also

Try SimLab — Free MATLAB® Alternative

466 functions. Runs in your browser. No install.

Open SimLab

Stay Updated

Get notified about new simulations and tools. We send 1-2 emails per month.