Graphics Programs Reference
In-Depth Information
disp([k + 1, sum(T)])
end
1.0000
6.1196
2.0000
6.4000
3.0000
6.8358
4.0000
6.1885
5.0000
6.0192
Multiplying each of these by $10,000 gives the portfolio amounts for the
five scenarios. Not surprisingly, all are less than what one obtains by
investing the original $50,000 all at once. But in this model it matters
where you enter the business cycle. It's clearly best to start your
investment program when a recession is in force and end in a boom.
Incidentally, the bank model yields in this case
(1/.08)*(((1.08)ˆ6) - 1) - 1
ans =
6.3359
which is better than the results of some of the previous investment models
and worse than others.
Problem 3
(a)
First we define an expression that computes whether Tony gets a hit or
not during a single at bat, based on a random number chosen between 0
and 1. If the random number is less than or equal to 0.339, Tony is
credited with a hit, whereas if the number exceeds 0.339, he is retired by
the opposition.
Here is an M-file, called atbat.m , which computes the outcome of a single
at bat:
%This file simulates a single at bat.
%The variable r contains a '1” if Tony gets a hit,
%that is, if rand <= 0.339; and it contains a ''0”
%if Tony fails to hit safely, that is, if rand > 0.339.
s = rand;
 
Search WWH ::




Custom Search