MATLAB
Matlab Functions List
Matlab Functions List
- ~~Only functions referenced in my notes are listed.~~
- Functions without a dedicated note are those that
- have a single syntax with nothing else worth saying,
- duplicate the usage of another function, or
- are rarely used
- For these, only the most basic syntax is kept.
- Symbols
... denotes variable-length argument omission
__ repeats the preceding syntax
<> marks an optional argument with a default value
<[]> means the brackets [] may be omitted, i.e. the argument may be either a variable-length list or an array
Basics
Mathematics
- Matlab Random Number Generation
round(a): nearest integer to a; break ties by rounding away from zero
fix(a): nearest integer to a toward 0
floor(a): nearest integer to a toward −∞
ceil(a): nearest integer to a toward +∞
real(z): real part of complex number z
imag(z): imaginary part of complex number z
abs(z): absolute or modulus
angle(z): phase angle in radians, in the range (−π,π]
conj(z): conjugate of complex number z
complex(a,b): complex number with real part a and imaginary part b
Matrix Manipulation
Data Type Construction
Identity Test
- Any function that starts with
is returns a logical value indicating whether the tested variable satisfies a certain condition
- Without special comment, the syntax is
iscond(a), which returns 1 if the condition cond is satisfied by variable a, and 0 otherwise
isa(var,type) tests if var is of type type
isnumeric
isfloat
isstruct
islogical
ischar
iscell
iscellstr tests if input is a cell array of strings
isnan
isinf
isfinite
isinteger
isreal
isscalar
isvector
issparse
isspace
isempty
isdir
iskeyword
isvarname tests if the input is a valid variable name
isglobal
ismember(var,set) tests if var is a member of set
isequal(a,b,...) tests if all inputs are equal
isequalwithequalnans(a,b,...) tests if all inputs are equal, treating NaN values as equal
issorted
isfield(struct,field) tests if struct has a field named field
Link to original
Matlab Operator
Operator
| Symbol | Role |
|---|
+ | Addition; Unary plus |
- | Subtraction; Unary minus |
.* | Element-wise multiplication |
* | Matrix multiplication |
./ | Element-wise right division |
/ | Matrix right division |
.\ | Element-wise left division |
\ | Matrix left division (also known as backslash) |
.^ | Element-wise power |
^ | Matrix power |
.' | Transpose |
' | Complex conjugate transpose |
| Symbol | Role |
|---|
== | Equal to |
~= | Not equal to |
> | Greater than |
>= | Greater than or equal to |
< | Less than |
<= | Less than or equal to |
| Symbol | Role |
|---|
& | Find logical AND |
| |
&& | Find logical AND (with short-circuiting) |
| |
~ | Find logical NOT |
| Symbol | Effect on Text |
|---|
'' | Single quotation mark |
| “ | Cell delimiter |
%{ %} | Block comments that extend beyond one line |
! | Operating system command |
? | Metaclass for MATLAB class |
~ | Argument placeholder to suppress specific input or output arguments |
< & | Specify superclasses |
.? | Specify fields of name-value structure when using function argument validation |
Operator Precedence
()
~, sign +, -
^, .^, transpose ', .'
.*, *, ./, /, .\, \
+, -
:
<, <=, ==, >=, >, ~=
&
|
&&
||
Link to original
Other