Beruflich Dokumente
Kultur Dokumente
Solve the following problems using a spreadsheet program such as Excel, MATLAB, and
Simulink. In order to get one bonus point you should send your complete and correct answer
including your program files by email not later than Monday, September 7th. The homeworks
are individual assignments and copying from others homeworks are strictly prohibited.
1. Use a spreadsheet program (Excel) to devise a Monte Carlo experiment to estimate
the value of , as in the equation for the area of a circle.
A = r2
Hint: Consider a quarter circle with unit radius inside a unit square. Throw a random
dart onto the unit square.
2. Enter these commands in MATLAB:
>> X = rand(12, 100000);
>> S = sum(X);
>> hist(S, 25)
Considering the histogram plotted by MATLAB, what can you say about the distribution of the variable S? Motivate your answer.
3. Use Simulink and MATLAB to simulate the predator-prey model discussed in the
first lecture, i.e. the following differential equation:
(
d
dt x(t) = rx(t) ax(t)y(t)
d
dt y(t) = sy(t) + bx(t)y(t)
Assume these values for constants r = 0.001, a = 2 106 , s = 0.01, b = a/2, and the
initial conditions x(0) = 12000 and y(0) = 600. Set the stop time of the simulation to
4000 and the Fixed-step size to 1 (see below) and simulate the system.
Change the initial condition x(0) = 50000 leaving other values unchanged and run
the simulation. How does this affect the result of the simulation? Are the predators
exterminated?
d2 x
d2 x
k
= x,
2
2
dt
dt
m
1
where m is the mass, k is the spring constant and x is the distance from the equilibrium
position. Of course this equation can be solved analytically, but there are many ODE that
have no analytical solution, especially those that are nonlinear.
Start Simulink and open the Simulink Library Browser:
1. Start MATLAB.
2. Enter simulink in the MATLAB Command Window.
The Simulink Library Browser opens. The Library Browser displays the Simulink block