Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Latest commit 57a1f9f Jan 29, 2021 History
1 contributor

Users who have contributed to this file

53 lines (33 sloc) 934 Bytes
function rksimple
clear
y0 = [1 0];
%y0 = [4,4];
tspan = [0 400];
[t,y] = ode45(@f5,tspan,y0);
figure(1)
%plot(t,y(:,1),t,y(:,2),t,y(:,3))
plot(t,y(:,1),t,y(:,2));
legend('1','2','3')
figure(2)
plot(y(:,1),y(:,2))
function yd = f5(t,y)
w = 1;
yp(1) = y(2);
yp(2) = -y(1) + 0.5*y(2)*(1-y(1).^2);
%mu = 1; beta = 1; w02 = 1;
%yp(1) = y(2);
%yp(2) = mu*y(2)*(1-beta*y(1)^2)-w02*y(1);
% yp(1) = -y(2) - y(1).^3 + 5*y(1);
% yp(2) = -y(2) + 4*(y(1)-0.0);
% mu = 1.5; beta = 1;
% yp(2) = -mu*y(2)+beta*y(1)*y(2); %SIR
% yp(1) = -beta*y(1)*y(2);
% yp(1) = w*(y(2)-y(3));
% yp(2) = w*(y(3)-y(1));
% yp(3) = w*(y(1)-y(2));
% yp(1) = y(1)*(1 - 2*y(1) + y(2));
% yp(2) = y(2)*(1 + y(1) - y(2));
%yd = [yp(1);yp(2);yp(3)];
yd = [yp(1);yp(2)];
end % end f5
end