Corrigés desexercices
169
+ diag(ones(N-1,1),-1));
A=A1+h2/12*A2+B;
b2= zeros(N,1);
b2(1)=(1-h2/12*C(1))*alpha
b2(N)=(1-h2/12*C(N+2))*beta
W(:,1)=alpha+(beta-alpha)*X;
for i=1:nt-1
W(:,i+1)=[alpha;A\(B*W(2:N+1,i)+b2);beta];
end
for i=1:nt
plot(X,W(:,i)); hold on
end
xx=0:T/40:T;
plot(xx,uinf(xx),’xr’)
hold off
✝
✆
✞
☎
function y=c1(x)
y=1./(1+x).^2;
✝
✆
✞
☎
function y=uinf(x);
r=(1- sqrt(5))/2;
y=(x+1).^r;
✝
✆
10.4 Équation de convection-diffusion
1. Partant de l’équation − u
( x i )+rc( x i ) u
( x i ) = f ( x i )pour i = 2 ,...,N +1,onobtient par
approximation que la solution approchée
V vérifie :
− v i − 1 +2v i − v i +1
h 2
+ rc( t i )
v i +1 − v i − 1
2 h
= f ( t i ) , i = 2 ,...,N
soit en multipliant par h
2
et sachant que v 1 = v N +2 = 0et
V =
⎛
⎝
0
V
0
⎞
⎠
A +
rh
2
B
V = F
où A , B et F ont été définis précédemment.
2...7. CD6.m
✞
☎
clear
N=4
r=1
h=1/(N+1);
Dunod –Laphotocopie non autorisée est un délit
169
+ diag(ones(N-1,1),-1));
A=A1+h2/12*A2+B;
b2= zeros(N,1);
b2(1)=(1-h2/12*C(1))*alpha
b2(N)=(1-h2/12*C(N+2))*beta
W(:,1)=alpha+(beta-alpha)*X;
for i=1:nt-1
W(:,i+1)=[alpha;A\(B*W(2:N+1,i)+b2);beta];
end
for i=1:nt
plot(X,W(:,i)); hold on
end
xx=0:T/40:T;
plot(xx,uinf(xx),’xr’)
hold off
✝
✆
✞
☎
function y=c1(x)
y=1./(1+x).^2;
✝
✆
✞
☎
function y=uinf(x);
r=(1- sqrt(5))/2;
y=(x+1).^r;
✝
✆
10.4 Équation de convection-diffusion
1. Partant de l’équation − u
( x i )+rc( x i ) u
( x i ) = f ( x i )pour i = 2 ,...,N +1,onobtient par
approximation que la solution approchée
V vérifie :
− v i − 1 +2v i − v i +1
h 2
+ rc( t i )
v i +1 − v i − 1
2 h
= f ( t i ) , i = 2 ,...,N
soit en multipliant par h
2
et sachant que v 1 = v N +2 = 0et
V =
⎛
⎝
0
V
0
⎞
⎠
A +
rh
2
B
V = F
où A , B et F ont été définis précédemment.
2...7. CD6.m
✞
☎
clear
N=4
r=1
h=1/(N+1);
Dunod –Laphotocopie non autorisée est un délit
