clear clc % Rungekutta syms x y f = input('Enter the slope:'); x0 = input('Enter the initial value of x:'); y0 = input('Enter the initial value of y:'); n = input('Enter the value of y to find:'); h = (n-x0)/100; for i=1:100 k1 = h * subs(f,{x,y},{x0,y0}); k2 = h * subs(f,{x,y},{x0+h/2,y0+k1/2}); k3 = h * subs(f,{x,y},{x0+h/2,y0+k2/2}); k4 = h * subs(f,{x,y},{x0+h,y0+k3}); y0 = y0 + 1/6*(k1+2*k2+2*k3+k4); x0 = x0 + h; end display(y0);