Fundamentals
Clear command window |
|
Clear all variables |
|
Clear specific variable |
|
Get standard documentation |
|
Get detailed documentation |
|
One line comment |
|
Print to command window |
|
Continue code on next line |
...
(Equivalent to space, don't split up 'Text') |
Links for Further Information
Graphics object properties |
|
Figure properties |
|
Line specification (LineSpec) |
|
Line Properties |
|
Axes Properties |
|
|
|
Mathematical Constants and Functions
π |
|
e |
|
∞ |
|
Exponential function |
|
Square root |
|
Sine |
|
Cosine |
|
Tangent |
|
Operators
Addition |
|
Subtraction |
|
Multiplication |
|
Division |
|
Left division |
|
Exponentiation |
|
Matrix and Vector Operations
Element-wise multiplication |
|
Element-wise division |
|
Element-wise exponentiation |
|
Transpose |
|
Dot product |
|
Cross product |
|
Format Specifiers
Single character |
|
Decimal notation (signed) |
|
Decimal notation (unsigned) |
|
Exponential notation |
|
Fixed-point notation |
|
String or char array |
|
|
|
Creating and accessing Matrices and Vectors
Create m by n matrix filled with ones |
|
Create m by n zero matrix |
|
Create m by n identity matrix |
|
Create row vector |
X = [1 2 3] or X
= [1, 2, 3] |
Create column vector |
|
Create matrix |
|
Create a vector with consecutive numbers |
|
Create a vector with consecutive numbers in a specific interval |
X = 0 : 0.1 : 1
(Start : Interval : End) |
Plotting
Plot values |
|
Plot values and set formatting |
|
Plot new values over old plot |
hold on
followed by a new plot(X, Y)
command |
Add plot title |
|
Add plot legend |
legend('<Name for plotted data>')
|
|
For Multiple plots: Separate names with commas. |
Add x-axis label |
|
Add y-axis label |
|
Rotate y-axis label to be horizontal |
ylabel('<Label>', 'Rotation', 0)
|
Turn on grid |
|
Add text to plot |
text(<X position>, <Y position>, '<Text>') |
|