Professional Documents
Culture Documents
Luis Cotrina - Metodo Heun
Luis Cotrina - Metodo Heun
## Created: 2019-06-14
function [y]=ed_heun(a,b,h)
t=[a:h:b];
f=-2*t.^3+12*t.^2-20*t+8.5;
yexac=-0.5*t.^4+4*t.^3-10*t.^2+8.5*t+1;
y(1)=1;
for i=1:length(t)-1
y(i+1)=y(i)+(0.5*f(i).+f(i+1).*0.5)*h;
endfor
plot(t,y)
grid
hold on
plot(t,yexac)
endfunction