|
以下是一段解偏微分方程组的程序,谁能告诉我用的是什么方法解的,我怎么查了好多资料都看不出来啊,谢谢大家了!
3 m$ b$ _3 p+ Z+ E8 K7 s2 m' f$ r2 m& h0 Y8 Y( w5 u& H# \+ J
% % Programme pour leopard %
9 J" G* b$ y! f3 _global d K F N 2 J- ~% p# E. @2 J, E. L1 _9 l
N = 64
7 z' S3 n* ~; I9 u; @' Adx = 1/N; : K4 a9 S7 @7 t1 u2 u; T
d=10 K=0.01 F=0.1
/ Z* H+ I6 m) G* W2 l$ B2 ] dt=0.001; , h8 _4 T7 j# |( S$ V. w7 Y
U=rand(N); V=rand(N);
6 o6 L9 \, ]) S) c, e1 i) uFourU=fft2(U); FourV=fft2(V); 9 ^7 ^9 s: f: c3 q- m. s7 s
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 " k/ o+ n0 f6 i Z! M; H+ d O
U=real(ifft2(FourU)); V=real(ifft2(FourV)); 7 j3 c$ s. A) C- G! e
compteur=0; & G* P. t5 x) U
for t=0:dt:1, 5 o: S V# e0 {& Q, x) g
format long max(max(U)) max(max(V)) min(min(V))
5 G U! A, ~& Q( _FourU=fft2(U); FourV=fft2(V); 7 }* o0 K4 G: \% D; P
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 , V# \4 k! X* }. c! a) }
U=real(ifft2(FourU)); V=real(ifft2(FourV)); 3 k6 @. z E4 _' _6 P }& X
for 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 1 [* K3 O! W6 }2 C
U = U + dt*P; V = V + dt*G; % d/ T2 D- L9 O
for i=1:N, for j=1:N, W(i,j)=V(i,j); M(i,j)=U(i,j); end end
& h8 i8 W8 R6 S' sif 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 : S4 K4 F/ s$ O% W3 p, j+ P. b
compteur = compteur +1; - a T6 B& Z1 X% E0 j& e- n7 Y; |( _
end %------------------------------------------
|