% % FISHSTORY.M Find fish population versus time for "Fish Story" Example % % This problem is described in some detail in the Class Notes for Differential % Equations. The basic idea was derived from Prob. 2 pg. 76 of Edwards and Penny % (Prentice Hall Inc., 1996). It addresses the NUMERICAL solution of a paricular % Population Model that approximates the fish population in a man-made pond. % % The population balance equation for this problem is % dP/dt = k*sqrt(P) % where k is a constant that needs to be determined based on data for the % particular problem. We will solve the problem for a range of k's. % % Calls FISHSTORY_EQNS.M to evaluate desired function P' = f(t,P). % % File prepared by J. R. White, UMass-Lowell (original March. 1998) % --> slight modifications (Jan. 1999) % % % getting started clear all; close all; nfig = 0; global kk % % define integration variables and initial condition to = 0; tf = 30; Po = 100; % time in months and P in numbers of fish % % let's define 4 values of k to investigate k = [.50 1.00 1.50 2.00]; % growth rate constant (units of sqrt(fish)/month) cols = ['r- ';'g: ';'b-.';'m--']; % % evaluate P(t) for each value of k Nk = length(k); for n = 1:Nk kk = k(n); [t,P] = ode23('fishstory_eqns',[to tf],Po); plot(t,P,cols(n,:)),hold on gtext(['k = ',num2str(kk,'%2.1f')]) end plot(6,169,'bx'),grid % mark the known experimental point gtext('expt') hold off title('Fish Population Versus Time for the "Fish Story" Example') xlabel('Time (months)'),ylabel('Number of Fish') % % end of problem %