Chapter 2 : Numeric, Cell, and Structure Arrays Flashcards
v(:)
represents all the row or oclumn elements of hte vector v
v(2:5)
represents the second through fifth elements; that is v(2), v(3), v(4), v(5)
A(:,3)
denotes all the elements in the third column of matrix A
A(3,:)
denotes all the elements in the thrid row of A
A(:,2:5)
denotes all the elements in the second through fifth columns of A
A(2:3,1:3)
denotes all the elements in the second and third rows that are also in the first through third columns
v=A(:)
creates a vector v consisting of all the columns of A stacked from first to last
A(end,:)
A(:,end)
denotes the last row in A
denotes the last column in A
sum(A)
sums the elements in each column of the array A and returns a row vector containing the sums
what is the command for dot and cross product?
dot(A,B)
cross(A,B)
what is the command for finding te roots of a polynomial
roots (a)
how do you create a polynomial in matlab?
type in the coefficients in decending order of powers of x. you do not need to type in any variables
what is the command to create a polynomial with specific roots?
p = poly([root, root])
what is the command for evaluating a polynomial, a , at specific values x
polyval(a,x)
what is the command for a graphical display of a cell’s array in the form of a grid?
B = { [#,#] , [#,#] } or A(1,1) = # A(1,2) = # etc then type cellplot(A) cellplot(B)