Corrigés desexercices
125
✞
☎
function A=matA(t);
A=[0 1;-1 -t];
✝
✆
SD6.m
✞
☎
a=0;b=1;
n=5
h=(b-a)/n;
t=a:h:b;
eta=[1;0];
U(:,1)=eta;
for j=1:n
A1=matA(t(j));
A2=matA(t(j)+h/2);
B=eye(2)+h*A2+h^2/2*A2*A1;
U(:,j+1)=B*U(:,j);
end;
U(:,6)
yex= exp(-t.^2/2);
plot(t,U(1,:),’.’,t,yex)
✝
✆
9. SD7.m
✞
☎
clear
a=0;b=1;
eta=[1;0];
A=[-11 ;0 -1];
U(:,1)=eta;
tn=[5 10 20 50 100 200]
for i=1:length(tn)
n=tn(i);
h=(b-a)/n;
t=a:h:b;
for j=1:n
A1=matA(t(j));
A2=matA(t(j)+h/2);
B=eye(2)+h*A2+h^2/2*A2*A1;
U(:,j+1)=B*U(:,j);
end;
yex= exp(-t.^2/2);
taberr(i)=norm(U(1,:)-yex,inf);
end
taberr
plot( log(tn),log(taberr))
a=polyfit( log(tn),log(taberr),1);
xlabel(’log(n)’,’Fontsize’,14)
ylabel(’log(erreur)’,’Fontsize’,14)
title([’Pentedeelaadroite::’,num2str(a(1))],’Fontsize’,18)
✝
✆
L’erreur est encore en 1 / n
2
.
 Dunod –Laphotocopie non autorisée est un délit
Précédent

- 109/188

Suivant