MATLAB Flashcards
Loops
cause specific code to repeat
ans
stores the result of an expression
roots(x)
roots of a polynomial
isinf(a)
returns 1 for infinite
ischar(a)
returns 1 for character
clf
clears figure window
subplot(m,n,p)
displays several plots in the same figure window
plot3(x,y,z)
plots function of two independent variables x and y
hold on
freezes the current plot for subsequent graphics command
branches
selects specific sections of code to execute
isnan(a)
returns 1 for not a number
any(a)
returns 1 if any elements do not equal 0
ones(n,m)
creates an n x m array of ones
ones(n)
creates an n x n array of ones
zeros(n,m)
creates an n x m array of zeros
zeros(n)
creates an n x n array of zeros
length(arr)
returns the length of a vector or longest dimension
load
loads file into workspace
!
embeds operating system commands directly into program
plot(x,y)
plots x and y versus each other
semilogx(x,y)
plots x on a logarithmic axis
semilogy(x,y)
plots y on a logarithmic axis
bar(x,y)
creates a bar chart
polar(theta,r)
polar plot
clc
clears command window
switch statement from
switches input expression
switch constant
code is executed based on the value of a single integer, character, of logical expression
logical(a)
converts numerical values to logical values (T/F)
all(a)
returns 1 if all elements are not equal to zero
isnumeric(a)
returns 1 for numeric array
isempy(a)
returns 1 for empty array
xor
exclusive OR
polyval(a,x)
evaluates a polynomial at specific values of its independent variable x
poly(x)
coefficients of the polynomial whose roots are specified by the array x
conv(a,b)
computes the product of two polynomials described by the coefficient of arrays a and b
\n
skip a line
fplot(y,[xmin x max])
automatically analyzes the functions and sets the plotting points so all features of the function are shown
plot(x,polyval(a,x))
plots the polynomial at specified values of the independent variable
eye(n,m)
creates an n x m identity matrix
eye(n)
creates an n x n identity matrix
size(arr)
returns number of rows and columns in array
save
saves data in workspace to a file
clear
clears variables in workspace