This preview shows page 1. Sign up to view the full content.
CS100M Section Exercise 9
1
Determinant of a
3
×
3
matrix
Write a function
myDeterminant(x)
, where
x
is a 3
×
3 matrix. Use the following formula:
det
abc
def
ghi
=
a
det
±±
ef
hi
²²

b
det
±±
df
gi
²²
+
c
det
±±
de
gh
²²
You may use the builtin function
det
to Fnd the determinants of 2
×
2 matrices. ±or example,
det(m)
returns
the determinant of 2
×
2 matrix
m
. Recall that you can construct a matrix by puting two row vectors one below
the other or two column vectors side by side.
2
Find a value in a matrix
Write the following function:
function [r, c] = findInMatrix(n,M)
% Find all occurrences of the number n in matrix M.
% r and c are column vectors of row and column numbers such that
%
M(r(k),c(k)) is equal to n.
% If n is not found in M, r and c are empty vectors.
3
Structure array
Write the following function for creating a
structure
for square data:
function Sqr= MakeSquare(x, y, L)
% Sqr is a square with
%
Sqr.x (xcoordinate of lower left corner) assigned x
%
Sqr.y (ycoordinate of lower left corner) assigned y
This is the end of the preview. Sign up
to
access the rest of the document.
This lab report was uploaded on 02/15/2008 for the course CS 100 taught by Professor Fan/vanloan during the Fall '07 term at Cornell University (Engineering School).
 Fall '07
 FAN/VANLOAN

Click to edit the document details