oops. here's what the function should look like
function [dy] = y(n,to,t,y0)
t=[0:0.01:5] h=[0.1 0.001] t0=0 y0=1 n=50 h=0.1 t=t0 y=y0 for i=1:n k=2-exp(-4*t)-2*y y=y+h*k t=t+h
print('t','y')
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!