Lectures 6 - 11 Flashcards
What is the generic code for an unconditional loop?
for loopvarname=m:s:n
statements
end
What is another name for unconditional loops?
For loops
What is another name for conditional loops?
while loops
What is the generic code for while loops
while (logical expressions)
statements
end
What are the criteria for while loops
logical expression must have a defined variable prior to the while statement
it must be updated with each iteration
What creates a 3D plot?
surf(x,y,z)
2D logarithmic x linear y
semilogx(x,y)
2D logarithmic y linear x
semilogy(x,y)
2D logarithmic x and y
loglog(x,y)
2D polar plot of theta and r
polar(th,r)
axis square
makes the plot area square
axis equal
sets the plot area with proportional axes (equal unit lengths)
axis normal
returns axes to default settings
grid on/grid off
turns on and of griddlines
hold on/hold off
freezes contents of plot area for adding other data series (lets you plot multiple data series on same figure)
Describe these line types
solid, dashed, dashed dot, dotted
-.
:
describe these color types
black blue red green cyan magenta yellow white
k black b blue r red g green c cyan m magenta y yellow w white
Describe these symbol types
dot asterisk x cross circle upright triangle inverted triangle square diamond 5 point star
. dot * asterisk X x \+ cross o circle ^ upright triangle V inverted trianlge s square d diamond p 5-point star
Puts a text string on the current plot with coordinates (x,y)
text(x,y,’my text’)
Puts a text string on the plot where the user clocks the arrow
gtext(‘my text’)
What are the basic types of mathematical models?
linear
power law
exponential
logarithmic
Matlab command that fits a polynomial of order n to data stored in vectors x,y. What does it also perform?
[p,s]=polyfit(x,y,n)
performs a least-squares method to obtain polynomial curvfits
What characterizes a perfect fit?
J = 0 (dimensional) and R^2 = 1 (dimensionless)