Use the up and down arrows to select a previous
command.
Or, type the first letters of a previous command before using the arrows
to select only the matching commands.
Use the left and right keys to edit commands.
x=5, y=1:10; z=7
will display the values of x
and z but not that of y (the latter is the array [1 2 3 4 5 6 7 8 9
10]
).
f(x,y,'string',z)
; for some
functions the parantheses are optional, but then the arguments are
seen as strings.
For example title Disk
is the same as
title('Disk')
.
sqrt(-1)
, the
imaginary unit
E.g., * denotes multiplication of matrices (if so
are the operands; dimensions must match).
However, 6*[1 2; 3 4]
multiplies each entry
of the matrix by 6 and 1+[1 2;3 4]
adds 1 to each
entry.
A.^2
squares each entry of the
array A, whereas A^2
squares the matrix (if
it is not a square matrix, an error is signaled). [1 2;
3 4] .* [3 5; 7 9]
multiplies entrywise the two matrices;
the result is [3 10; 21 36]
.
sin([pi/2 pi 3*pi/2])
gives [1 0
-1]
.
x=[1 2 3
4]
use x .* sin(x)
.
who
or whos
to list current variables
clear
to remove all variables
clear x, y, matr*
to remove certain variables
WARNING:
save xyvariables x y
% saves x and y in binary to the file xyvariables.mat load xyvariables
% restores x and y
save ~/xvalues x -ascii
% save the
values of x in the file ~/xvalues.mat
x=load('~/xvalues')
% assign to x its
saved values
help diary
says:
DIARY Save text of MATLAB session. DIARY FILENAME causes a copy of all subsequent command window input and most of the resulting command window output to be appended to the named file. If no file is specified, the file 'diary' is used. DIARY OFF suspends it. DIARY ON turns it back on. DIARY, by itself, toggles the diary state. Use the functional form of DIARY, such as DIARY('file'), when the file name is stored in a string.