Refcard Card Octave
Refcard Card Octave
Refcard Card Octave
Starting Octave
octave
octave file
octave --help
C-k
C-y
M-d
M-DEL
M-y
Stopping Octave
quit or exit
INTERRUPT
TAB
M-?
RET
C-p
C-n
M-<
M->
C-r
C-s
history [-q] [N ]
exit Octave
(e.g. C-c) terminate current command and
return to top-level prompt
Getting Help
help
help command
help -i
help -i command
Motion in Info
SPC or C-v
DEL or M-v
C-l
history -w [file]
history -r [file]
Searching in Info
Shell Commands
s
C-s
C-r
i
,
cd dir
pwd
ls [options]
getenv (string)
system (cmd)
[]
Permissions on back
Matrices
Square brackets delimit literal matrices. Commas separate
elements on the same row. Semicolons separate rows. Commas
may be replaced by spaces, and semicolons may be replaced by
one or more newlines. Elements of a matrix may be arbitrary
expressions, provided that all the dimensions agree.
[ x, y, ... ]
[ x; y; ... ]
[ w, x; y, z ]
\\
\"
\
\n
\t
a literal backslash
a literal double-quote character
a literal single-quote character
newline, ASCII code 10
horizontal tab, ASCII code 9
Index Expressions
var (idx)
var (idx1, idx2)
scalar
vector
range
Global Variables
global var1 ...
automatic replot
do fortran indexing
implicit str to num ok
output max field width
output precision
page screen output
prefer column vectors
resize on range error
save precision
silent functions
warn divide by zero
Ranges
base : limit
base : incr : limit
Specify a range of values beginning with base with no
elements greater than limit. If it is omitted, the default
value of incr is 1. Negative increments are permitted.
+ y
- y
* y
.* y
/ y
addition
subtraction
matrix multiplication
element by element multiplication
right division, conceptually equivalent to
(inverse (y) * x)
x ./ y
x \ y
x .\ y
x ^ y
x .^ y
- x
+ x
x
x .
++ x (-- x)
x ++ (x --)
inverse (x) * y
Assignment Expressions
var = expr
var (idx) = expr
Statements
Linear Algebra
chol (a)
det (a)
eig (a)
expm (a)
hess (a)
inverse (a)
norm (a, p)
pinv (a)
qr (a)
rank (a)
schur (a)
svd (a)
syl (a, b, c)
break
continue
return
< y
<= y
== y
>= y
> y
!= y
& y
| y
! bool
true
true
true
true
true
true
true
true
true
if
if
if
if
if
if
if
if
if
x is less than y
x is less than or equal to y
x is equal to y
x is greater than or equal to y
x is greater than y
x is not equal to y
both x and y are true
at least one of x or y is true
bool is false
Operator Precedence
Here is a table of the operators in Octave, in order of
increasing precedence.
; ,
=
|| &&
| &
< <= == >= > !=
:
+ * / \ .* ./ .\
.
+ - ++ -- !
^ .^
statement separators
assignment, groups left to right
logical or and and
element-wise or and and
relational operators
colon
addition and subtraction
multiplication and division
transpose
unary minus, increment, logical not
exponentiation
Defining Functions
function [ret-list] function-name [ (arg-list) ]
function-body
endfunction
ret-list may be a single identifier or a comma-separated list of
identifiers delimited by square-brackets.
arg-list is a comma-separated list of identifiers and may be
empty.
diag (v, k)
create diagonal matrices
linspace (b, l, n) create vector of linearly-spaced elements
logspace (b, l, n) create vector of log-spaced elements
eye (n, m)
create n by m identity matrix
ones (n, m)
create n by m matrix of ones
zeros (n, m)
create n by m matrix of zeros
rand (n, m)
create n by m matrix of random values
Cholesky factorization
compute the determinant of a matrix
eigenvalues and eigenvectors
compute the exponential of a matrix
compute Hessenberg decomposition
invert a square matrix
compute the p-norm of a matrix
compute pseudoinverse of a
compute the QR factorization of a matrix
matrix rank
Schur decomposition of a matrix
singular value decomposition
solve the Sylvester equation
Signal Processing
fft (a)
ifft (a)
freqz (args)
sinc (x)
Image Processing
colormap (map)
set the current colormap
gray2ind (i, n)
convert gray scale to Octave image
image (img, zoom)
display an Octave image matrix
imagesc (img, zoom)
display scaled matrix as image
imshow (img, map)
display Octave image
imshow (i, n)
display gray scale image
imshow (r, g, b)
display RGB image
ind2gray (img, map)
convert Octave image to gray scale
ind2rgb (img, map)
convert indexed image to RGB
loadimage (file)
load an image file
rgb2ind (r, g, b)
convert RGB to Octave image
saveimage (file, img, fmt, map) save a matrix to file
Sets
create set (a, b)
complement (a, b)
intersection (a, b)
union (a, b)
Strings
strcmp (s, t)
strcat (s, t, ...)
compare strings
concatenate strings
Miscellaneous Functions
eval (str)
feval (str, ...)
error (message)
clear pattern
exist (str)
who
Polynomials
compan (p)
conv (a, b)
deconv (a, b)
poly (a)
polyderiv (p)
polyreduce (p)
polyval (p, x)
polyvalm (p, x)
roots (p)
residue (a, b)
companion matrix
convolution
deconvolve two vectors
create polynomial from a matrix
derivative of polynomial
integral of polynomial
value of polynomial at x
value of polynomial at x
polynomial roots
partial fraction expansion of ratio a/b
Statistics
corrcoef (x, y)
cov (x, y)
mean (a)
median (a)
std (a)
var (a)
correlation coefficient
covariance
mean value
median value
standard deviation
variance
Basic Plotting
gplot [ranges] expr [using] [title] [style]
gsplot [ranges] expr [using] [title] [style]
ranges
expr
using
title
style
2D plotting
3D plotting
set options
show options
replot
closeplot
purge tmp files
automatic replot
title (string)
axis (limits)
xlabel (string)
ylabel (string)
grid [on|off]
hold [on|off]
ishold
mesh (x, y, z)
meshdom (x, y)
plot 3D surface
create mesh coordinate matrices