Fall 2011 – PGE 310: Formulation and Solution in Geosystems Engineering
Homework #3: Matrix Operation  Working with Input/Output Files – Plotting
Due Date:
Thursday September 15
th
2011
Do NOT forget to follow the guideline for submitting homework
(Attached to the end of this file)
1.
Matrix Operation in MATLAB
(BY MATLAB)
Do the following in the
Command Window
of MATLAB:
a)
Create a random
4
3
matrix
A
, a random
1
4
column vector
b
, and a random scalar
c
.
(In all of them the random numbers should be between 2 and 4)
b)
Using colon notation, replace the 3
rd
row of matrix
A
by the elements of vector
b.
c)
Combine matrix
A
and vector
b
and create a combination matrix
B
in which the first three rows are the
same as matrix
A
and the fourth row is composed of the elements of vector
b
d)
Create another
4
4
matrix
C
with random numbers between 4 and 2.
e)
Calculate matrix
D
which is element by element division of
B
divided by
C
.
f)
Using the “
reshape
” command, make matrix
D
a new matrix
E
which has 8 rows and 2 columns.
g)
Using period notation, raise each element of vector
b
to the power of
c
(the random scalar created in
part a) and store the results in new vector
e
.
h)
Save all the variables in a
.mat
file called
myalldata.mat
.
i)
Save matrices
B
,
C
and
D
, and vectors
b
and
e
in a
.txt
file called
Values.txt
.
j)
Open
Values.txt
in notepad and print it out.
Print out
all your work
including all
commands
and
results
.
2.
Matrix Operation and Working with Input/Output Files
(By MATLAB)
Imagine that in Engineering Economics course, cash flow statements of three oil companies are given in three
text files called:
Exxon.txt
,
Chevron.txt
and
BP.txt
. The data are given over years 2008 to 2010, and
they are categorized in four groups:

Operating Cash Flows

Investment Cash Flows

Finance Cash Flows

Effect of Exchange Rate
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.
 Fall '06
 Klaus
 Linear Algebra, Cash Flow Statement, Operating cash flow

Click to edit the document details