Permalink
##
Matlab-Programs-for-Nonlinear-Dynamics/

Go to file
Cannot retrieve contributors at this time

# 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?

##
Matlab-Programs-for-Nonlinear-Dynamics/**rksimple.m**

Go to file
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

53 lines (33 sloc)
934 Bytes

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters

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 | |