|
以下是一段解偏微分方程组的程序,谁能告诉我用的是什么方法解的,我怎么查了好多资料都看不出来啊,谢谢大家了! 6 N. D/ K4 a* K1 Z6 h* Y. F
/ ?, x0 B. z. @3 @
% % Programme pour leopard % . y7 v) F5 ~; J; [- Q+ p+ k/ O4 [
global d K F N
, Z, H; C. }, c5 E+ kN = 64
% U6 @+ f/ |$ Idx = 1/N; 6 w- I8 D' z, @7 H. U
d=10 K=0.01 F=0.1
5 m# L# u+ z! H1 v4 i1 U# ]+ g dt=0.001; b/ {! e/ _ Y* i* N& }
U=rand(N); V=rand(N);
" x1 s+ ?! d. l) iFourU=fft2(U); FourV=fft2(V); 0 d+ |: [) w2 v$ h1 ]2 C
for i=1:N, for j=1:N, i0=i-1; j0=j-1; if i0 > N/2 i0=1+N-i; end if j0 > N/2 j0=1+N-j; end FourU(i,j)=FourU(i,j)/(1+(i0*i0+j0*j0)/8); FourV(i,j)=FourV(i,j)/(1+(i0*i0+j0*j0)/8); end end - N! S; f Y3 o* i' M/ R9 d
U=real(ifft2(FourU)); V=real(ifft2(FourV));
6 i, l0 ^6 e5 p% O3 a3 pcompteur=0; : l5 j7 _- [- V; s, G" f2 i9 Q/ f
for t=0:dt:1,
9 J! t* A) A% |+ {( A. p3 C6 yformat long max(max(U)) max(max(V)) min(min(V)) 6 b" r& V# v3 [9 M
FourU=fft2(U); FourV=fft2(V);
8 m; R+ Z( x' r+ k5 {for i=1:N, for j=1:N, i0=i-1; j0=j-1; if i0 > N/2 i0=1+N-i; end if j0 > N/2 j0=1+N-j; end FourU(i,j)=FourU(i,j)*exp(-dt*(i0*i0+j0*j0)/10); FourV(i,j)=FourV(i,j)*exp(-d*dt*(i0*i0+j0*j0)/10); end end
, b% N8 h6 X, s) N Q4 F0 lU=real(ifft2(FourU)); V=real(ifft2(FourV));
4 v& g# N! l1 f' s* Z$ nfor i=1:N, for j=1:N, P(i,j)=-U(i,j)*V(i,j)^2+F*(1-U(i,j)); G(i,j)=U(i,j)*V(i,j)^2-(F+K)*V(i,j); end end ! g4 a0 d- {1 a6 d
U = U + dt*P; V = V + dt*G; 6 _: a" y/ J3 ^; ~( J
for i=1:N, for j=1:N, W(i,j)=V(i,j); M(i,j)=U(i,j); end end " M. F! f2 M: ?
if rem(compteur,10) == 0 clf; if W>0.6 image(100*W-60); else image(100*W) end if M>0.6 image(100*M-60); else image(100*M); end drawnow; end " ^+ U% ~/ a4 ]/ S
compteur = compteur +1;
5 g7 J5 T# y e+ z. v9 u/ Zend %------------------------------------------
|