|
以下是一段解偏微分方程组的程序,谁能告诉我用的是什么方法解的,我怎么查了好多资料都看不出来啊,谢谢大家了!
9 d% p* ], R( K* K& |+ W* e8 I7 A( f3 A" E
% % Programme pour leopard %
- a6 L7 A3 f6 {global d K F N ! ^) V( Y2 f2 c$ E
N = 64
; w, _) p* r8 ]) |dx = 1/N;
7 a) ?) l( g7 E8 I# s5 _7 Id=10 K=0.01 F=0.1
( h" W5 q% K: R. ^8 ^% w3 x0 e dt=0.001; % E8 x. f' _3 C3 F
U=rand(N); V=rand(N);
' i& w. e1 j3 _+ f0 K: pFourU=fft2(U); FourV=fft2(V);
1 s* }1 R9 X- ]3 Ffor 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 , H! j, d4 H. E! Z" u
U=real(ifft2(FourU)); V=real(ifft2(FourV)); ( a, f1 Q5 O+ U, C$ q$ a
compteur=0;
' `, E+ i- |; p5 U! M& _for t=0:dt:1,
. I! q5 Q( b! X9 N0 M' T! B/ Hformat long max(max(U)) max(max(V)) min(min(V)) 4 ^+ e! k8 c# z T$ M% p! s1 M1 N
FourU=fft2(U); FourV=fft2(V);
/ M: C' |! h T% `4 W: _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
* ] ~# o# e* O9 }' N, }U=real(ifft2(FourU)); V=real(ifft2(FourV));
' o. V" Y3 h6 X6 `) E# z& Afor 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
: @# r1 u! l4 j7 \ ^7 e+ q+ ^U = U + dt*P; V = V + dt*G;
/ W/ G: ^4 x9 K! f0 X' nfor i=1:N, for j=1:N, W(i,j)=V(i,j); M(i,j)=U(i,j); end end : {5 z E# r# ~7 l! k% v
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 " v- V" V( R8 I
compteur = compteur +1;
! o e: K) \+ K& v: m- T: v4 M$ jend %------------------------------------------
|