|
以下是一段解偏微分方程组的程序,谁能告诉我用的是什么方法解的,我怎么查了好多资料都看不出来啊,谢谢大家了!
$ B6 x4 \. c& b& V/ @
7 C6 A# G# p, Q# k( n4 O4 M* d% % Programme pour leopard %
/ H$ s' E' }; m7 Fglobal d K F N
5 A7 e4 R; P3 `0 _ LN = 64
# l0 L* [6 p( cdx = 1/N; 7 `6 n, R, T% }# M) g u
d=10 K=0.01 F=0.1 5 D, j8 d; \9 X% o" C8 s ^6 @: c
dt=0.001;
& |' q* X. z( I4 A% qU=rand(N); V=rand(N); F1 I7 [) e# f" z2 P# U; F" S( G2 {
FourU=fft2(U); FourV=fft2(V); - n6 v# H& V* z& |; L
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 6 N/ S: F' e- v5 v. G4 E
U=real(ifft2(FourU)); V=real(ifft2(FourV)); % g K1 \8 P0 V
compteur=0;
$ B+ E& Z7 ^9 f7 \for t=0:dt:1, $ m _9 p: c& m- a
format long max(max(U)) max(max(V)) min(min(V))
- N4 I6 |: ^) X2 _* B7 E' k n9 ZFourU=fft2(U); FourV=fft2(V); % k# o: _9 @- b1 X! V+ B" ^0 m
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 # q7 B: `+ C2 u5 G
U=real(ifft2(FourU)); V=real(ifft2(FourV));
0 A# k8 `6 b/ Gfor 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
. _, y$ u8 D# |! Q& X- oU = U + dt*P; V = V + dt*G; + {1 }8 Y0 Q5 D
for i=1:N, for j=1:N, W(i,j)=V(i,j); M(i,j)=U(i,j); end end
$ E) S! H& h- y. a Q* N s% p9 Yif 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
* P; c7 B, i4 Q9 xcompteur = compteur +1;
2 B2 a9 s/ }9 o, K' `6 wend %------------------------------------------
|