Skip to content

Commit

Permalink
Solitons Final
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrubeck committed Nov 30, 2016
1 parent 7d66809 commit 314d995
Show file tree
Hide file tree
Showing 36 changed files with 46 additions and 64,630 deletions.
4 changes: 2 additions & 2 deletions ODE/RungeKutta.m
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
function y = RungeKutta(f, yi, ti, h, n)
% Solves an initial value problem of the form dy/dt=f(t, y).
y=zeros([size(yi) n]);
y=zeros(n, length(yi));
for i=1:n
k1=h*f(ti, yi);
k2=h*f(ti+h/2, yi+k1/2);
k3=h*f(ti+h/2, yi+k2/2);
k4=h*f(ti+h, yi+k3);
yi=yi+(k1+2*k2+2*k3+k4)/6;
ti=ti+h;
y(i)=yi;
y(i,:)=yi;
end
end
Loading

0 comments on commit 314d995

Please sign in to comment.