function predator x0 = 200; % initial number of rabbits y0 = 10; % initial number of foxes T = 300; % final time options = odeset('RelTol',1e-4,'AbsTol',[1e-4 1e-4]); [t,z] = ode45(@preprey,[0 T],[x0 y0],options); plot(t,z(:,1),'b',t,z(:,2),'r') function dz = preprey(t,z) a = .04; b = .0002; c = .08; d = .0004; x = z(1); y = z(2); dz = zeros(2,1); dz(1) = a*x - b*x*y; dz(2) = -c*y + d*x*y;