## RK45(dydt, trange, yinit, tol)

version 1.0.0.0 (2.51 KB) by
RK45 is like matlab's ode45. its can be used on octave as it comes without ode solver.

Updated 06 Nov 2017

% function solves ordinary differential equation just like ode45.
% dydt = system of first order differential equations
% trange = range of the independent variable
% yinit = initial condition
% tol = error absolute tolerance, default value = 1e-6;
% Example:
% [t,y] = RK45(@(t,y)[y(2); (1-y(1)^2)*y(2)-y(1)],[0 20],[2; 0]);
% subplot(1,2,2);
% plot(t,y,'-o')
% title('Solution of van der Pol Equation (\mu = 1) with RK45');
% xlabel('Time t');
% ylabel('Solution y');
% legend('y_1','y_2');
%
% [t2,y2] = ode45(@(t,y)[y(2); (1-y(1)^2)*y(2)-y(1)],[0 20],[2; 0]);
% subplot(1,2,1);
% plot(t2,y2,'-o')
% title('Solution of van der Pol Equation (\mu = 1) with ODE45');
% xlabel('Time t');
% ylabel('Solution y');
% legend('y_1','y_2');

### Cite As

Lateef Adewale Kareem (2022). RK45(dydt, trange, yinit, tol) (https://www.mathworks.com/matlabcentral/fileexchange/64968-rk45-dydt-trange-yinit-tol), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2012b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux