clear g = '2*t*y'; function out = f(y,t) out = evstr(g) endfunction t0 = 0.1; y0 = 1; h = 0.05; n = 20; Yr =[]; Tr =[]; y = y0; t = t0; for j = 1:n k1 = f(y,t); k2 = f(y+ (h*k1*0.5) , t+(h*0.5)); k3 = f(y+ (h*k2*0.5) ,t+(h*0.5)); k4 = f(y+ (h*k3) , t+h); y = y + (h/6)*(k1 + 2*k2 + 2*k3 + k4); t = t+h; Yr(j) = y; Tr(j) = t; end R = [Tr Yr]