Math 448/548 - Example 6.4 - Chaos in the Whale Problem
This Matlab code illustrates the period doubling in the Whale Problem.
clear all, close all, clc alpha = 10^(-7);
Choose initial condition and terminal time T, plus the time step h
x=[5000;70000]; T = 1200; % terminal time % Plot also the dynamics of each individual species as a function % of time. for h = [1 2 24 27 32 37] % time step N = floor(T/h); % numer of iterations t=0:h:T; x=[5000;70000]; X=x; for n=1:N rhs = [0.05*x(1)*(1-x(1)/150000)-alpha*x(1)*x(2); 0.08*x(2)*(1-x(2)/400000)-alpha*x(1)*x(2)]; x = x + h*rhs; X=[X x]; end figure subplot(2,1,1) plot(t,X(1,:),'bo','MarkerFaceColor','k','MarkerSize',2) title(strcat('Blue whale dynamics vs time, h=',num2str(h))); xlabel('t'); ylabel('Blue Whales'); subplot(2,1,2) plot(t,X(2,:),'go', 'MarkerFaceColor','k','MarkerSize',2) title(strcat('Fin whale dynamics vs time, h=',num2str(h))); xlabel('t'); ylabel('Fin Whales'); end





