% Matlab diary from cs111, Nov 26 2007. % % This is what I typed in class. % % Type it into Matlab yourself to % reproduce the output I showed. diary on swinger clc timespan = [ 0 10 ] help ode23tx ode23tx('f', timespan, 1); xlabel('time t') ylabel('function values y(t)') exp(10/2) exp(5/2) hold on plot([1:10], exp([1:10]/2),'r') clc clf close all % now edit f to end with ydot = -y/2; ode23tx('f', timespan, 1); % now edit f to end with ydot = t/2; ode23tx('f', timespan, 1); clc edit lotka ode23tx('lotka',[0 20],[300;150]); legend('rabbits','foxes') ode23tx('lotka',[0 20],[15 ; 22]) ode23tx('lotka',[0 20],[102 ; 198]) ode23tx('lotka',[0 20],[100 ; 200]) axis([0 20 0 300]) clc ode23tx('lotka',[0 20],[300;150]); [T,Y] = ode23tx('lotka',[0 20],[300;150]); T Y plot(T, Y(:,1)) plot(T, Y) plot(Y(:,1), Y(:,2)) xlabel('rabbits') ylabel('foxes') title('Phase Space Plot') diary off