|
以下是一段解偏微分方程组的程序,谁能告诉我用的是什么方法解的,我怎么查了好多资料都看不出来啊,谢谢大家了! 9 C' i; y4 h& |
8 B2 x! q% e! [5 T$ ~8 D% % Programme pour leopard % ) s5 o/ Q4 H% [+ b4 _! |$ }
global d K F N 7 g8 L& J! m' B
N = 64 & d) Q* C/ B1 Y" t. [
dx = 1/N;
% z: J9 i. K. Y% M* h+ i* wd=10 K=0.01 F=0.1
' ]% p' o; z: n dt=0.001;
6 d& [! z2 c, |0 t; B1 NU=rand(N); V=rand(N); / \; m7 E9 i' v3 t. r# Z
FourU=fft2(U); FourV=fft2(V);
" [# O! r% T. mfor 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
' k8 F, R# e4 S. `" O3 r UU=real(ifft2(FourU)); V=real(ifft2(FourV)); ' _2 t4 ~) n0 P+ r6 o5 i9 M3 [
compteur=0;
4 S$ Y( J# f1 F0 G& ]) X# Sfor t=0:dt:1,
& ?& k% e+ n: l) Jformat long max(max(U)) max(max(V)) min(min(V))
3 b k! d2 H$ z3 @: W& iFourU=fft2(U); FourV=fft2(V); * G8 [1 K; y: O0 i) N
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
\- z7 | s1 G1 G! b1 B& N, tU=real(ifft2(FourU)); V=real(ifft2(FourV));
! i1 A8 P# ^9 }! c: dfor 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 - [2 ?7 ^* A9 b$ Q. ?6 A
U = U + dt*P; V = V + dt*G; 2 {- ]6 c0 G# k
for i=1:N, for j=1:N, W(i,j)=V(i,j); M(i,j)=U(i,j); end end
3 k4 }/ v O1 f) b8 ` _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
0 ~: j9 r% l! Y4 ?) f+ Acompteur = compteur +1;
. w7 t2 B7 N) t) F( R2 L% P4 O5 Lend %------------------------------------------
|