Matlab - programa con backward euler

 
Vista:

programa con backward euler

Publicado por elisa (1 intervención) el 29/01/2013 18:11:03
hola,tengo que resolver una ecuacion mediante newton raphson y para averiguar el punto de inicio tengo que usar backward Euler.la ecuacion a resolver es y1+0.2*1.2*exp(y1)-1=0 , f(t1,y1)=-t1*exp(y1) y h=0.2.alguien podria ayudarme???

function [t,x]=ejemploeuler(h)
h=0.2;
N=10/h;
for k=1:N
x(k)=1;
t(k)=1;
t(k+1)=t(k)+h;
x(k+1)=x(k)+(h*-t(k+1)*exp(x(k+1)))
end
end



function [x1,t1]=MNR(x0,tol,F1,t0)

N=0;
while 1
x0=0.5;
N=N+1;
h=0.2;
t0=1;
t1=t0+h;
F1=-t*exp(x);
Fu1=-t*exp(x);
x1=x0-(F1(x0)/Fu1(x0));
tol=0.05;
error=abs(F1(x1));
fprint(N,x1,error);
if error<=tol
disp('the value of the root in the non lineal equation is equal to ')
x1
error
break
else
x0=x1 ;
end
end

end
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder