CE 335
Old exam questions (with solutions following) for Chapters 14
1]
Write a Matlab function that determines whether any given year is a leap year in the Gregorian
calendar. It should return 1 if the positive integer
year
is a leap year and 0 otherwise. (Leap years are
divisible by 4 but not by 100, unless they are divisible by 400; thus, 2000 and 2008 are leap years, but
1900, 2009, or 2100 are not.)
(Possibly useful builtin function: if
a
and
b
are integers,
rem(a, b)
returns the remainder of a
÷
b.)
The first line of the function should be
function is_leap_year = leap(year)
2]
Consider a freefalling bungee jumper whose velocity is given by
(1)
dv/dt = g  (c
d
/m)v
2
The drag coefficient c
d
is actually not constant but increases as the bungee jumper falls because air is
more dense lower in the atmosphere. We suppose that
(2)
dc
d
/dz = c
d
/H
where H is a scale height of the atmosphere. (Note that v = dz/dt.)
Suppose that g = 10 m s
2
, m = 60 kg, and H = 8
×
10
3
m. The initial conditions at t = 0 s are v = 0 m s
1
and c
d
= 0.2 kg m
1
. We want to estimate v at some later time(s).
(a) Show how you would apply Euler's method to solve this problem (i.e. write an approximate
expression for v(t +
Δ
t) in terms of the values of variables at the current time t).
(b) Write a Matlab script to estimate v at t = 10 s using Euler's method with a timestep
Δ
t of 1 s.
3]
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 '11
 Lybas
 Numerical Analysis, Cos, Pond, function is_leap_year, dcd /dz

Click to edit the document details