MATLAB sample files

Differential Equations

To simulate differential equation models, you need two m-files: one describes the model
and the other plot the solutions and other functions.

<>1:  predprey.m
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
function [Ydot] = predprey(t,Y)
r=2; K=1.4; s=1; c=0.5; a=2; d=0.1;
Ydot(1) = r*Y(1)*(1-Y(1)/K)-s*Y(1)*Y(2)/(a*Y(1)+1);
Ydot(2) = Y(2)*(c*s*Y(1)/(a*Y(1)+1)-d);
Ydot=Ydot';
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

2:  predpreyf.m

This matlab file plots solutions and isoclines of the Holling type II predator-prey model.

3: insu18f.m  insu18.m

This simulates the problem #18, page 206 (Chapter 5).

4: ppbif.m

This file draws a bifurcation diagram for the Holling type II
predator-prey model. In this case, you do not need to specify
the parameter values. Instead, you need to add

global time IC r K s c a d

5: logistRand.m

A program of simulating logistic equation with noises in growth rate and carrying capacity.