Introductory Programming Fall 2005 Today's instructions 1) create a file named f.m in the usual place you put scripts 2) type in the following code function dydt = f(t, y) dydt = t + y; end 3) evaluate this function from the command line and make sure it does what you expect. 4) type 'help ode45' and read the documentation, or at least as much of it as you can stand 5) run 'ode45(@f, [0, 1], 0)' What does this command do? 6) Alternatively, you can run '[T, Y] = ode45(@f,[0, 1], 0);' and then 'plot(T, Y)' 7) Use ode45 to find a numerical solution to the differential equation dx/dt = g (T - x) + d(T^4 - x^4) + el u^2 with T = 293.15, g = 50, d = 2e-7, el = 800 and u=21. The initial condition is x(0) = 25. (See the problem statement on the next page.) 8) Here is the program I wrote to compute mouse populations: 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) = 100; 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 Write a version of f.m that computes dN/dt for given values of N and t, and use it to estimate the population of mice over t = [0, 8] with the initial value N = 100. Does the solution agree with what we got when we did the integration ourselves?