202
11
•
Problèmes
De même si c ( x ) = 1, on obtient
m ij =
⎧
⎪ ⎨
⎪ ⎩
0s i j /∈{i − 1 , i , i +1}
h / 6s i j = i − 1 , ou j = i +1,
2 h / 3s i j = i .
Finalement, pour le second membre, on remplace b i =
L
0
f ( x ) w i ( x ) dx par ¯
b i =
L
0
¯
f ( x ) w i ( x ) dx
où ¯
f ( x ) =
n
j = 0
f ( x j ) w j ( x ), si bien que b i =
n
j = 0
m ij f ( x j )puisque c = 1etlesystème àrésoudre
devient:
( R + M ) z = M ¯
b ,
où M =
h
6
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎝
41
0
... 0
14
10
01
410
. . .
. . .
. . .
. . . 0
. . .0 141
0 ...
014
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎠
, R =
1
h
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎝
2 − 10
... 0
− 12− 10
0 − 12− 10
. . .
. . .
. . .
. . . 0
. . .0 − 12− 1
0
... 0 − 12
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎠
et ¯
b =
⎛
⎜
⎝
f ( x 1 )
. . .
f ( x n )
⎞
⎟
⎠
b) Programmation
ELF2.m
✞
☎
global RFinvM
N=4
h=1/(N+1);
x=(0:h:1)’;
M=h/6*(4*diag(ones(N,1))+diag(ones(N-1,1),1)+ diag(ones(N-1,1),-1))
invM= inv(M);
R=1/h*(2*diag(ones(N,1))-diag(ones(N-1,1),1)- diag(ones(N-1,1),-1))
F=-2+6*x(2:N+1)
eta0=u0(x(2:N+1));
[t,V]=ode23(’phi’,[0,1],eta0);
V=[ zeros( length(t),1),V, zeros( length(t),1)];
[xx,tt]=meshgrid(x,t);
subplot(2,2,1)
%V(3,:)
surf(xx,tt,V,’EdgeColor’,’none’)
xlabel(’x’,’Fontsize’,18)
Précédent

- 181/188

Suivant