function predatorprey

[T, Y] = ode45(@yprime, [0 100], [100 100]);

subplot(211);
plot(T, Y(:,1), '-', T, Y(:,2), '--');
title('Population Dynamics of Foxes and Rabbits');
legend('Rabbit Population', 'Fox Population');
xlabel('t');
ylabel('Population');
grid on;

subplot(212);
plot(Y(:,1), Y(:,2));
title('Phase Plane Diagram for thbe Fox-Rabbit Population');
xlabel('Rabbits');
ylabel('Foxes');
grid on;

end %function

%rhs function
function dy = yprime(t, y)
    g = 0.4;
    d1 = 0.001;
    d2 = 0.1;
    c = 0.002;
    dy = [g*y(1) - d1*y(1)*y(2); c*y(1)*y(2) - d2*y(2)];
end %function