Quick Reference
Home Up Quick Reference M-files Laser Printing 1. Matlab Basics 2. Sequences & Series 3. Taylor Series 4. Fields & Flows 5. ODE Models 6. Symbolic ODE 7. Systems & 2nd order 8. Numerical ODE 9. Laplace Transform

Links                    

Matlab Primer
Matlab Primer (1)
Matlab Primer (2)
Matlab Primer (3)

MATLAB Quick Reference

Below is a basic list of the built-in MATLAB commands that we will use for this course. It is by no means complete, but should help in getting us started. For more detailed help and/or examples, please consult one of help methods outlined below. Also see the MATLAB Primer, see the side bar.

In the following chart, 'a' and 'b' refer specifically to numbers while 'x' and 'y' refer to either numbers or lists of numbers of the same length. In particular, to eliminate any redundancy, if a specific operation works for lists, the exact same usage works a single number.

In addition, if an operation/function acts on a list, then the operation is performed component-wise. For example, under usages for the operation of multiplication is listed a*x and x.*y (note the use of ".*" when multiplying lists). This means that if we let a=5, x=[1,2,3,4] and y=[2,3,5,7] then a*x=[5,10,15,20] and x.*y=[2,6,15,28].

 

.

NAME

USAGE

COMMENTS

HELP

command-line help

help topic

Gives help/examples on the specified topic

help window

helpwin

Opens a help window

on-line help

helpdesk

Opens an on-line help window

CONSTANTS

Pi

pi

3.14159...

e

exp(1)

2.71828...

i

i, j

sqrt(-1)

OPERATIONS

addition

x+y

subtraction

x-y

multiplication

a*x, x.*y

division

x/a, x./y

a\x (y.\x) is equivalent to x/a (x./y)

powers

a^b, a.^x, x.^a, x.^y

BASIC
FUNCTIONS

square root

sqrt(x)

sine

sin(x)

csc, sec, cot, acsc, asec, acot, sinh, cosh, tanh, csch, sech, coth, asinh, acosh, atanh, acsch, asech, acoth are also defined.

cosine

cos(x)

tangent

tan(x)

inverse sine

asin(x)

inverse cosine

acos(x)

inverse tangent

atan(x)

exponential

exp(x)

ex

logarithm

log(x)

natural logarithm

factorial

gamma(n+1)

n!

summation

sum(x)

the sum of the elements of x

product

prod(x)

the product of the elements of x

partial summation

cumsum(x)

the partial sums of the elements of x

partial product

cumprod(x)

the partial products of the elements of x

PLOTTING

ezplot

ezplot(f)
ezplot(f,xmin,xmax)

f is a string or a symbolic object

plot

plot(y)
plot(x,y)
plot(x,y,s)

s is a string that specifies the plot options of color and style. y is the list of y-coordinates to plot and x is the corresponding x-coordinates

fplot

fplot(f,lims)

f is a string and lims=[xmin xmax] or [xmin xmax ymin ymax]

new plot

figure

Creates a new blank graph on which to plot. The old plot will remain and can be edited by simply selecting it and then typing the desired commands into

MATLAB.

hold on

hold on

Enables multiple plots on same graph

hold off

hold off

Disables multiple plots on same graph

plot title

title('text')

label x-axis

xlabel('text')

label y-axis

ylabel('text')

label plot

gtext('text')

Used to label any desired part of a plot

CREATING NEW
FUNCTIONS

inline

f=inline('f',n)

f is a function of n.

M-files

-

See p.41 of 'ODEs using Matlab'

SYMBOLIC
TOOLBOX

define variable

syms X

Defines X to be a symbolic variable. Must define a symbolic variable before using the following functions.

taylor series

taylor(f)
taylor(f,a)
taylor(f,n)
taylor(f,n,a)

The output is a symbolic object that represents the taylor polynomial of f of degree n-1 centered at a.

to string

char(f)

Converts a symbolic object into a string. Useful for plotting symbolic objects with fplot

 

 

Jump to Bruce Driver's Homepage.                       Jump to Current Courses Page.

Last modified on October 05, 1999 at 10:42 AM.