Matlab: The Language of Technical Computing
Matlab: The Language of Technical Computing
User Guide
dir
type
delete
cd
diary command
diary
diary filename
diary off
+
*
/
\
^
()
addition
subtraction
multiplication
division
left division
power
complex conjugate transpose
specify evaluation odder
long command lines, with followed by Return
constants
pi
i
j
eps
realmin
realmax
inf
NaN
3,14159265
imaginary unit
same as i
floating-point relative precision , 2-52
smallest floating-point number, 2-1022
largest floating-point number, (2-)21023
infinity
not-a-number
format command
format short
format short e
format short g
format long
format long e
format long g
format bank
format rat
format hex
format compact
or ctrl-p
or ctrl-n
or ctrl-b
or ctrl-f
ctrl- or ctrl-r
ctrl- or ctrl-l
home or ctrl-a
end or ctrl-e
esc or ctrl-u
del or ctrl-d
backspace or ctrl-h
generating matrices
zeros( )
ones( )
rand( )
randn( )
load *.dat
magic(n)
[n11 n12 n13;n21 n22 23;n31 n32 n33]
manipulating matrices
[]
det( )
eig( )
poly( )
sum( )
.*
./
.\
.^
.
find( )
==
<
>
isequal
isemty
all
any
if else if else end
switch case otherwise end
for end
while end
break
{ } or cell
text
double( )
char( )
cellstr( )
S.
S.field designator
equal
less
greater
check matrices with not the same size for equality
check if matrices are emty
check all if they are true
check any if it is true
syntax of the if statement
executes statements based on value of a variable
repeats statements a fixed number of times
repeats statements an indefinite number of times
exit earlier from a for or a while loop
cell array
enter text into MATLAB using single quotes
converts text to ASCII codes for each character
converts ASCII codes or cell array into text
convert text into cell array of strings
structures are multidimensional MATLAB arrays
create array with element by textual field designator
figure
subplot(n,m,i)
plot(t,y1,t,y2)
hold on/off
ishold
Symbol
color (RGB)
c
m
y
r
g
b
w
k
cyan (0 1 1)
magenta (1 0 1)
yellow (1 1 0)
red (1 0 0)
green (0 1 0)
blue (0 0 1)
white (1 1 1)
black (0 0 0) (default)
Symbol
line style
-:
-.
none
Symbol
marker
+
o
*
.
x
square
diamond
^
v
>
<
pentagram
hexagram
none
plus sign
circle
asterisk
point
cross
square
diamond
upward pointing triangle
downward pointing triangle
right pointing triangle
left pointing triangle
five-pointed star
six-pointed star
no marker (default)
axis handle
axis on/off
axis vis3d on/off
axis ([xmin,xmax,ymin,ymax,zmin,zmax])
axis square
axis equal
axis tight
axis auto
axis manual
axis ij
axis xy
axis image
axis normal
DataAspectRatio
DataAspectRatioMode
PlotBoxAspectRatio
PlotBoxAspectRatioMode
Position [left,bottom,width,height]
XLim, YLim, ZLim
XLimMode, YLimMode, ZLimMode
text(x,y,text1,text2,text3)
gtext
\it
\alpha | beta | delta
\leftarrow | rightarrow
\pi
\bullet
\fontname{times}
grid on/off
hidden on/off
colorbar
box on/off
rotate3d
hot
cool
spring
summer
autumn
winter
gray
lighting
color
style local/infinite
position
visible
AmbientLightColor
AmbientStrength
DiffuseStrength
SpecularStrength
SpecularExponent
SpecularColorReflectance
FaceLighting flat/Gouraud/Phong
EdgeLighting flat/Gouraud/Phong
BackFaceLighting reverselit/lit
FaceColor
EdgeColor
VertexNormals
NormalMode
material
makes the objects shiny
makes the objects dull
makes the objects metallic
material shiny
material dutty
material metal
viewpoint control
set viewpoint
view([Azimuth Elevation])
camera properties
CameraPosition
CameraPositionMode auto/manual
CameraTarget
CameraTargetMode auto/manual
CameraUpVector
CameraUpVectorMode auto/manual
CameraViewAngle
CameraViewAngleModeauto/manual
orthographic/perspective Projection
stem(t,y,fill)
stairs( )
clabel
contour
contour3
contourf
moviein
getframe
movie
erase modes
EraseMode none
EraseMode background
EraseMode xor
2.4 Images
image
imagesc
imread
imwrite
imfinfo
axis
image(X); colormap(map)
imagesc(I,[0 1]); colormap( )
image(RGB)
drawnow
patch(x,y,[z],colordata)
colordata
CData
CDataMapping
FaceVertexCData
EdgeColor
FaceColor
MarkerEdgeColor
MarkerFaceColor
Courier,Symbol,Times-Roman,Helvetica
4..35
points
bold
oblique
SelectionHighlight
Tag
Type
UserData
Visible
2.8 Figures
figures properties
Menubar
controlling color
Colormap
FixedColors
MinColormap
ShareColors on/off
Dithermap
DithermapMode auto/manual
BackingStore on/off
Renderer
Pointer custom
PointerShapeCData
PointerShapeHotSpot
printing figures
PaperOrientation
PaperPosition
PaperPositionMode
Papersize
Papertype
PaperUnits
InvertHardCopy
2.9 Axes
axes properties
General information
Annotation
Axis control
Viewpoint
specific task.
It is very important that:
1. The user always know where they are.
2. They do always know where to go next.
!!! The GUI has to be simple, consistent and familiar !!!
simple
consistent
familiar
Simplicity:
Consistency:
Familiarity:
use the familiar to draw users into the GUI a small connection to the users
real world experience (touch-tone phone pad)
The Dynamic Interface
snappy direct
smooth physical
friendly encouraging
immediate
continuous
reversible
Permit Direct Manipulation whenever possible, let the user grab the data (i.e. slider)
Define Task
Start
Draw GUI
Test Design
Design
Write Code
Test Code
Stop
Implementation
Dont forget about the ButtoDownFcn everything from a line to a figure has
a ButtoDownFcn
Prevent overplotting with handle visibility the HandleVisibility property lets
your hide your GUI from the MATLAB command line
Animate with WindowButtonMotionFcn animate a response as the mouse is
being dragged in combination with WindowButtonDownFcn or
WindowButtonUpFcn
tf(num,den,variable,Ts)
num
den
variable
zpk(z,p,k,variable,Ts)
k
p
z
variable
ss(a,b,c,d,e,Ts)
a
b
c
d
e
statename
[num,den,Ts]=tfdata( )
[z,p,k,Ts]=zpkdata( )
[a,b,c,d,Ts]=ssdata( ), dssdata
Ts > 0 ,Ts = 0, Ts = -1
dss( )
filt( )
set( )
get( )
model conversion
conversion to TF
conversion to ZPK
conversion to SS
partial fraction expansion
invert LTI system
sys=tf(sys)
sys=zpk(sys)
sys=ss(sys)
residue
inv( )
LTI properties
set(sys,inputname,text)
set(sys,inputname,text)
notes
Td
userdata
PropertyValue=get(sys,PropertyName)
PropertyValue=sys.PropertyName
sys.PropertyName=PropertyValue
covar( ,w)
pade( )
continuous/discrete conversion
c2d( ,Ts)
d2c( )
d2d( ,Ts)
c2d( ,Ts,foh)
d2c( ,tustin)
input/output balancing
minimal realization or pole/zero cancellation
state deletion in I/O balanced realization
general characteristics
model type (tf,zpk, or ss
true if LTI model is of specified type
true for continuous-time model
true for discrete-time model
true for empty LTI model
true for proper LTI models
true for SISO models
output/input/state dimensions
model dynamics
covar
damp
dcgain
dsort
esort
norm
pole,eig
pzmap
tzero
state-space realization
canonical state-space realizations
controllability matrix
controllability staircase form
controllability and observability gramians
observability matrix
oberservability staircase form
state coordinate transformation
diagonal balancing of state-space realization
canon
ctrb
ctrbf
gram
obsv
obsvf
ss2ss
ssbal
bode( ,{fmin,fmax})
nyquist( )
nichols( )
sigma( )
linspace
logspace
freqresp( )
evalfr
freqresp
margin
ngrid
Plot Types
Systems
Characteristics
pzmap
rltool
rlocfind
rlocus
sgrid
zgrid
pole-zero map
root locus design GUI
interactive root locus gain selection
evans root locus plot
continuous , grid for root locus
discrete , grid for root locus
pole placement tools
acker
estim
place
reg
equation solvers
care
dare
lyap
dlyap
dlqr
kalman
kalmd
lqgreg
lqr
lqrd
lqry
rltool
You can specify the number of times that you want MATLAB to evaluate the
commands by entering a number in the Stop After field.
You can start processing the command by clicking on the Start button.
You can suspend processing the commands by clicking on the Pause button.
You can change the delay between iterations by clicking on the Faster and
Slower buttons, either before or during the simulation.
You can stop processing the command by clicking on the Stop button.
Working with MATLAB Output
To delete output cells use the Purge Output Cells command or press Alt-P.
If you want to suppress a graphical output from an input cell, place the cursor in the
input cell and select Toggle Graph Output for Cell from the Notebook menu.
Printing an M-Book
When printing an M-Book, cells are printed in its defined color.
Style
Normal
AutoInit
Error
Input
Output
Font
Times New Roman
Courier New
Courier New
Courier New
Courier New
Size
10 points
10 points
10 points
10 points
10 points
Weight
Bold
Bold
Bold
Color
Black
Dark Blue
Red
Dark Green
Blue
State Zustnde
History Junction Gedchtnis, Anwendung bei verschiedenen Hierachieebenen
Default Transition mglicher bergang von einem State zu einem anderen
Connective Junction Knotenpunkt um Transitionen zu vebinden
States:
Schlsselwort
State name
entry
during
exit
on event-name
Erklrung
Name des States muss immer eindeutig sein
Diese Aktion wird unmittelbar nach dem
bergang in den State ausgefhrt also mit
dem Event, das den bergang auslst.
Diese Aktion wird mit jedem Event
ausgefhrt das stattfindet, whrend der
Zustand aktiv ist. Die Aktion wird jedoch
nicht durch das Event ausgefhrt, welches
den bergang auslst
Diese Aktion wird beim verlassen des States
ausgefhrt, also mit dem Event, den den
bergang in den nchsten Zustand auslst.
Diese Aktion wird nur ausgefhrt, wenn der
Zustand aktiv ist und das Ereignis
event-name stattfindet.
Transitions:
allgemeiner Syntax: event[condition]{condition_action}/transition_action
Schlsselwort
event
[condition]
{condition_action}
transition_action
Erklrung
eintretendes Ereigniss
Bedingung die erfllt sein muss
Aktion die ausgefhrt werden soll
erst wenn Ziel der Transition erkannt wurde,
wird die transition_action ausgefhrt