Octave Reference Card
Octave Reference Card
Octave Reference Card
SPC
DEL
or C-v
or M-v
scroll forward one screenful
scroll backward one screenful le argument) Global Variables
C-l redraw the display history -r [le] read history from le ( /.octave hist if global var1 ... Declare variables global.
no le argument) Global variables may be accessed inside the body of a
Node Selection in Info edit history lines edit and then run previous commands function without having to be passed in the function
from the history list parameter list provided they are also declared global within
n select the next node run history lines run previous commands from the history the function.
p select the previous node list
u
t
select the `up' node
select the `top' node [beg ] [end ] Specify the rst and last history Selected Built-in Variables
d select the directory node commands to edit or run. EDITOR editor to use with edit history
< select the rst node in the current le If beg is greater than end, reverse the list of commands Inf, NaN IEEE innity, NaN
> select the last node in the current le before editing. If end is omitted, select commands from LOADPATH path to search for function les
g reads the name of a node and selects it beg to the end of the history list. If both arguments are PAGER program to use to paginate output
C-x k kills the current node omitted, edit the previous item in the history list. ans last result not explicitly assigned
eps machine precision
Searching in Info Shell Commands pi
cd dir change working directory to dir realmax maximum representable value
s search for a string pwd print working directory realmin minimum representable value
C-s search forward incrementally
C-r search backward incrementally ls [ options] print directory listing automatic replot automatically redraw plots
i search index & go to corresponding node getenv ( string) return value of named environment do fortran indexing Fortran-style indexing of matrices
, go to next match from last `i' command variable implicit str to num ok allow strings to become numbers
shell cmd ( cmd) execute arbitrary shell command string output max field width maximum numeric eld width
Command-Line Cursor Motion output precision min signicant gures displayed
C-b move back one character Matrices page screen output control whether output is paged
create column vectors by default
C-f move forward one character Square brackets delimit literal matrices. Commas separate prefer column vectors
C-a move the the start of the line elements on the same row. Semicolons separate rows. Commas resize on range error automatic resizing of matrices
C-e move to the end of the line may be replaced by spaces, and semicolons may be replaced by save precision digits stored by save command
M-f move forward a word one or more newlines. Elements of a matrix may be arbitrary silent functions suppress output from functions
M-b move backward a word expressions, provided that all the dimensions agree. warn divide by zero suppress divide by zero errors
C-l clear screen, reprinting current line at top [ x, y, ... ] enter a row vector commas in literal matrix
[ x; y; ... ] enter a column vector control handling of spaces in matrices
Inserting or Changing Text [ w, x; y, z ] enter a 22 matrix ignore function time stamp
M-TAB insert a tab character ignore changes in function les during session
DEL delete character to the left of the cursor Ranges
C-d delete character under the cursor base : limit ok to lose imaginary part
C-v add the next character verbatim base : incr : limit allow complex to real conversion
C-t transpose characters at the point Specify a range of values beginning with base with no prefer zero one indexing
M-t transpose words at the point elements greater than limit. If it is omitted, the default if ambiguous, prefer 0-1 style indexing
value of incr is 1. Negative increments are permitted.
[ ] surround optional arguments ... show one or more arguments
Copyright 1994, John W. Eaton Permissions on back
Arithmetic and Increment Operators Statements Linear Algebra
x+y addition for identier = expr stmt-list endfor a
chol ( ) Cholesky factorization
x-y subtraction Execute stmt-list once for each column of expr. The a
det ( ) compute the determinant of a matrix
x*y matrix multiplication variable identier is set to the value of the current column a
eig ( ) eigenvalues and eigenvectors
x .* y element by element multiplication during each iteration. a
expm ( ) compute the exponential of a matrix
x/y right division, conceptually equivalent to a
hess ( ) compute Hessenberg decomposition
(inverse (y') * x')' condition) stmt-list endwhile
while ( a
inverse ( ) invert a square matrix
x ./ y element by element right division Execute stmt-list while condition is true. a p
norm ( , ) compute the p-norm of a matrix
x\y left division, conceptually equivalent to pinv ( )a compute pseudoinverse of a
inverse (x) * y break exit innermost loop a
qr ( ) compute the QR factorization of a matrix
x .\ y element by element left division continue go to beginning of innermost loop rank ( )a matrix rank
x^y power operator return return to calling function a
schur ( ) Schur decomposition of a matrix
x .^ y element by element power operator a
svd ( ) singular value decomposition
- x negation if (condition) if-body [else else-body] endif a b c
syl ( , , ) solve the Sylvester equation
+ x unary plus (a no-op)
x' complex conjugate transpose Execute if-body if condition is true, otherwise execute else-
x .' transpose body. Equations, ODEs, DAEs, Quadrature
++ x (-- x) increment (decrement) x, return new value if (condition) if-body [elseif (condition) elseif-body] endif *fsolve solve nonlinear algebraic equations
x ++ (x --) increment (decrement) x, return old value Execute if-body if condition is true, otherwise execute the *lsode integrate nonlinear ODEs
elseif-body corresponding to the rst elseif condition that *dassl integrate nonlinear DAEs
Assignment Expressions is true, otherwise execute else-body.
Any number of elseif clauses may appear in an if
*quad integrate nonlinear functions
var = expr assign expression to variable statement. perror ( nm, code) for functions that return numeric codes,
var (idx) = expr assign expression to indexed variable print error message for named function
unwind protect body unwind protect cleanup cleanup end and given error code
Comparison and Boolean Operators Execute body. Execute cleanup no matter how control exits * See the on-line or printed manual for the complete list of
These operators work on an element-by-element basis. Both body. arguments for these functions.
arguments are always evaluated.
x<y true if x is less than y Dening Functions Signal Processing
x <= y true if x is less than or equal to y fft ( ) a Fast Fourier Transform using FFTPACK
x == y true if x is greater than y function ret-list] function-name [ (arg-list) ]
[ ifft ( ) a inverse FFT using FFTPACK
x >= y true if x is greater than or equal to y function-body freqz ( args) FIR lter frequency response
x>y true if x is equal to y endfunction sinc ( ) x returns sin ( x)/( x)
x != y true if x is not equal to y
x&y
x|y
true if both x and y are true
true if at least one of x or y is true
ret-list may be a single identier or a comma-separated list of
identiers delimited by square-brackets.
Image Processing
! bool true bool is false colormap ( ) map set the current colormap
arg-list is a comma-separated list of identiers and may be gray2ind ( , ) i n convert gray scale to Octave image
empty.
Short-circuit Boolean Operators image ( , img zoom
)
img zoom
display an Octave image matrix
display scaled matrix as image
Operators evaluate left-to-right, expecting scalar operands.
Operands are only evaluated if necessary, stopping once overall
Basic Matrix Manipulations imagesc (
imshow ( ,
, )
img map
) display Octave image
truth value can be determined. Operands are converted to rows ( )a return number of rows of a imshow ( , ) i n display gray scale image
scalars by applying the all function. columns ( ) a return number of columns of a imshow ( , , ) r g b display RGB image
all ( )a check if all elements of a nonzero ind2gray ( , img map
) convert Octave image to gray scale
x && y true if both x and y are true any ( )a check if any elements of a nonzero ind2rgb ( , img map
) convert indexed image to RGB
x || y true if at least one of x or y is true find ( ) a return indices of nonzero elements loadimage ( ) le load an image le
sort ( ) a order elements in each column of a r g b
Operator Precedence sum ( )a sum elements in columns of a rgb2ind ( , , ) convert RGB to Octave image
le img fmt, map) save a matrix to le
Here is a table of the operators in Octave, in order of prod ( ) a product of elements in columns of a saveimage ( , ,