function edoeuler_v2(f,t0,tf,p0,h)
t = [t0:h:tf]';
n=length(t);
if t(n)<tf
t(n+1)=tf;
n = n+1;
end
p= p0*ones(n,1);
for i = 1:(n+1)
p(i+1) = p(i) + h*f(t(i),p(i));
end
salida=[t p];
output(salida)
end
And then i got this in the command view
edoeuler_v2(@(p)0.0169*t,0,5,0.03,1)
Error using @(p)0.0169*t
Too many input arguments.
Error in edoeuler_v2 (line 10)
p(i+1) = p(i) + h*f(t(i),p(i));
0 Comments
Sign in to comment.