MASSACHUSETTS INSTITUTE OF TECHNOLOGY
Department of Civil and Environmental Engineering
1.017 Computing and Data Analysis for Environmental Applications
Quiz 1 (Solutions)
Thursday, October 5, 2000
Please answer Problems 15 and either Problem 6 or Problem 7 (maximum score = 100 points):
Problem 1 (15 points)
Suppose
a = [ 4
3
1]
b = [ 3 2
7]
Evaluate the following expressions …
test=a.*b>6
ftest=find(a.*b>6)
Problem 2 (15 points)
Write a MATLAB script which generates the sequence given by:
N
(
i
) = 1
i
= 1,2
N
(
i
) =
N
(
i 
1) +
N
(
i 
2)
i
> 2
The first few number of this sequence are:
1, 1, 2, 3, 5, 8, 13, …
Problem 3 (15 points)
Soil saturation (
S
) is the fraction of a soil's pore space filled by water.
Suppose that this saturation
is related to the capillary pressure (
P
) of soil water as follows:
S
= 1
for
P
< 10
S
= 1 + 0.01(10  P)
for 10
≤
P
< 100
S
=
0.1
for
P
>100
a) Write a MATLAB function called
sp
which takes a vector of
P
values and returns a vector of
corresponding
S
values.
b) Write a MATLAB function called
plotsp
that plots an
S
vs
P
curve over the range
P
= 0 to
150.
The function
plotsp
should call the function
sp
to obtain values for the plotting.
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 '05
 GeorgeKocur
 matlab, Environmental Engineering, Return statement, AirTrain Newark, Matlab function

Click to edit the document details