Variables and Vectors
MATLAB (and Octave, the free engine StudyPass runs your code on) stores every value as a matrix — even a single number is a 1x1 matrix. That's what makes it so good at the vector/matrix work you'll do throughout your degree.
Assigning a variable
x = 5
y = 3.2
No semicolon means MATLAB prints the result immediately. Add a semicolon to assign silently:
x = 5;
Vectors
A row vector is a comma- or space-separated list in square brackets:
v = [1, 2, 3, 4]
A column vector uses semicolons between entries:
w = [1; 2; 3; 4]
The colon operator builds a sequence fast — start:step:end:
t = 0:0.5:2
Why This Matters for Your Exams
Vector notation is how MATLAB represents everything from a set of data points to a system's state over time — get comfortable with row vs. column vectors now, since mixing them up is the single most common beginner error (and MATLAB's error messages about it can be cryptic).
Try it yourself
Change the vector below and press Run to see MATLAB's own output.
Real-time practice is a paid add-on
Reading units and the practice quiz are free. Pay once to unlock running real code for LaTeX & MATLAB.

