%RK4 Func MATRIX
function [jared, baller] = RK4(dxdt, span, init, int)

%Init x and ys
x = span(1);

y = init;

jared(1) = x;

%Calculate h width and sets init conditions for MATRIX
h = (span(2) - span(1))/int;

[j, k] = size(init');

baller(1:j,1) = init';

%Loop for RK4 Equation
for i=1:int
    
    %RK4 k values
    k1 = dxdt(x, y)';
    k2 = dxdt(x+0.5*h, y+0.5*k1*h)';
    k3 = dxdt(x+0.5*h, y+0.5*k2*h)';
    k4 = dxdt(x+h, y+k3*h)';
    
    %Combines k val for RK4
    y = y + (1/6)*(k1 + 2*k2 + 2*k3 + k4)*h;
    
    %Outputs into matrix
    x = x + h;
    
    jared(i + 1) = x;
    
    baller(1:j,i+1)=y';
    
end


    
    