This preview shows pages 1–3. Sign up to view the full content.
UNIVERSITY OF CALIFORNIA, BERKELEY
Engineering 7 – Spring 2009
Department of Civil and Environmental Engineering
Instructor: Professor Rector
1
Lab 01
Topics
:
Arrays, Matrices, Linear Algebra, and Basic Plotting
Assigned
:
Friday, 01/30/2009
Due
:
Friday, 02/06/2009 at 12:00 pm
Type
:
Take Home
Remember to use the
help
command if you are not familiar with a command. It will be much
faster than waiting for a GSI to answer your question. Moreover, a list of useful commands is
provided at the end of this document.
For this lab, you may submit your report as one Word document or one PDF file. Remember to
also submit the report on Bpsace! Turn the hardcopy of your lab in the drop boxes at 1109
Etcheverry Hall computer lab.
0. Downloading the files related to Lab 01
In order to save time, some of the matrices used in this lab are provided to you. They are provided in
several files with extension
.mat
and whose names start with
lab1
. These files are located in the
Lab
01
folder of the
Lab Assignments
section of the E7 Resources page on Bspace.
You can download
the files directly by clicking on their names in this PDF document.
Download the file
lab1matrices.mat
now, and save it to your home directory. This file will be used in question 1(b).
You will also have to save other files in the rest of this lab.
1. Array Creation (Using Matrix Generation Functions)
The purpose of this part is to create arrays using matrix generation functions. You should be able to create
each matrix with one single expression; also make note that while the answers are not unique, there are
more “efficient” answers.
You will receive no credit if you create these arrays manually! Copy the expressions to create each
of the following matrices (
A
through
G
) and the output into your lab report.
(a)
Create the following matrices using the matrix generation functions
zeros
,
eye
, and
ones
.
Use the help
command if you are not familiar with the syntax of these functions.
⎥
⎦
⎤
⎢
⎣
⎡
=
0
0
0
0
0
0
A
,
⎥
⎥
⎥
⎦
⎤
⎢
⎢
⎢
⎣
⎡
=
5
0
0
0
5
0
0
0
5
B
,
⎥
⎦
⎤
⎢
⎣
⎡
=
3
3
3
3
C
(b)
Make sure
lab1matrices.mat
is in your current Matlab directory.
If you type
load
lab1matrices.mat
in Matlab, the matrices
D
,
E
and
F
should have been created in your
workspace. Warning: if you already have a variable named
D
,
E
or
F
, it will be overwritten.
⎥
⎦
⎤
⎢
⎣
⎡
=
9
6
3
2
D
,
⎥
⎦
⎤
⎢
⎣
⎡
−
=
9
1
4
1
E
,
⎥
⎦
⎤
⎢
⎣
⎡−
=
3
5
5
5
F
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentLab 01
2
UNIVERSITY OF CALIFORNIA, BERKELEY
Engineering 7 – Spring 2008
Department of Civil and Environmental Engineering
Instructor: Professor Rector
Create the following matrix (G) using the matrices D, E, and F given above.
Use the function
blkdiag
or the
colon notation to create this matrix:
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎦
⎤
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎣
⎡
−
−
=
3
5
0
0
0
0
5
5
0
0
0
0
0
0
9
1
0
0
0
0
4
1
0
0
0
0
0
0
9
6
0
0
0
0
3
2
G
(c)
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '08
 Patzek
 Environmental Engineering

Click to edit the document details