matlab assignment

profileLeila@
lab_week_3.pdf

ENGR 232 Matlab Assignment Week # 3

A single person infected with Ebola returned to his village, which had no one else infected, at time t=0. The virus is spread through contact between sick and well members of the population. Let P be the proportion of the population that has contracted the virus. The proportion of the population that has been infected can be expressed by the first order differential equation:

𝑑𝑃

𝑑𝑡 = 𝑘 𝑃 (1 − 𝑃) 𝑃(0) = 𝑃0

where the growth constant k is 0.02. The village was quarantined, limiting the total population to 10,000. Assume no one enters or leaves the village during the modeling time.

1. Use Euler’s method with a time step of 10 hours to numerically approximate the system for 1000 hours. With this method how long will it take for half the population to be infected? Print the answer. Plot your solution curve, label your axes.

2. Repeat the Euler’s method with time steps of 1 hours. With this method how long will it take for half the population to be infected? Print the answer. Plot your solution curve, label your axes.

3. Solve the system using ode45() by using a function with naming convention ebola.m. Plot the solution on the same figure, add a legend. With this method how long will it take for half the population to be infected? Print the answer. Plot your solution curve, label your axes.

4. Comment on the solutions of the three different simulations above.

Euler’s Method: y '  f (t, y)

t n1

t n h

y n1

y n hf (t

n , y

n )

Note: Submit a published pdf file of your script with convention lastname_initials_lab3.m

The published document must include all functions used. All figures must be annotated

(labels, legends, markers, title, etc. Answers to questions asked should be printed as an

output.