MAE 107  Homework # 4
Numerical Methods in Engineering
Prof. Alison Marsden
Due date: Friday April 29, 2011
Problem 1  (MATLAB) See the structure of a matrix:
Create
a 20
×
20 matrix with command
A = ones(20)
. Now replace the 10
×
10 submatrix between rows 6 : 15 and columns 6 : 15 with zeros. See
the structure of the matrix (in terms of nonzero entries with the command
spy(A)
. Set the 5
×
5 submatrices in the top right corner and bottom left
corner to zeros and see the structure again.
Problem 2  (MATLAB) Do some cool operations:
Create a 10
×
10
random matrix with the command
A = rand(10)
. Now do the following
operations.
•
Multiply all elements by a 100 and then round oﬀ all elements of the
matrix to integers with the command
A=ﬁx(A)
.
•
Replace all elements of
A <
10 with zeros.
•
Replace all elements of
A >
90 with inﬁnity (
inf
).
•
Extract all 30
≤
a
ij
≤
50 in a vector
b
, that is, ﬁnd all elements of
A
that are between 30 and 50 and put them in a vector
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Rottman
 Linear Algebra, Prof. Alison Marsden

Click to edit the document details