Introductory Programming Fall 2005 For today you should have 1) reviewed Chapter 3 2) prepared for an Evaluation Today 1) Evaluation 5 2) discussion of Evaluation 4 Functions --------- A model of the execution of a function 1) evaluate the argument (which is an expression) 2) assign the resulting value to the input variable 3) run the body of the function 4) the value of the output variable is the return value 5) replace the original function call with the return value 6) resume whatever you were doing when you got to the function call. Evaluation 4 ------------ You can download my solution from http://wb/ip/code/mice.m a = 0.9; B = [70 36 11 1 4 13 28 43 56] * 1e-4; t0 = 0; tend = 8; % months n = 1000 dt = (tend - t0) / n; t = zeros(1, n+1); % time N = zeros(1, n+1); % mouse population t(1) = t0; N(1) = 900; for i=2:n+1 t(i) = t(i-1) + dt; index = floor(t(i-1)+1); b = B(index); dN = dt * (a * N(i-1) - b * N(i-1) ^ 1.7); N(i) = N(i-1) + dN; end plot(t, N) peak = max(N)