?? adsorption_reflect.m
字號(hào):
%吸附反射
function adsorption_reflect(Z)
A=zeros(222); %為避免溢出,定義222*222;A表示能量,100表示空白
A(:)=100;
N=zeros(222); %N is the number of partical,100 means no
N(:)=100;
M=zeros(200); %show the region
M(:)=N(12:211,12:211);
M=Z+M-100; %疊加顯示
imshow(M,[min(min(M)),max(max(M))]);
for j=1:aa
for i=1:bb
x=fix(random('unif',12,211));
y=fix(random('unif',12,211));
w=fix(random('unif',12,211));
w0=A(x,y);
if w0>=1&w>=1
A(x,y)=min(w0,w)-1;
N(x,y)=N(x,y)-1;
end
end
M(:)=N(12:211,12:211);
pause(1);
M=Z+M-100;
imshow(M,[min(min(M)),max(max(M))]);
if w<30
A(x,y)=w0;
N(x,y)=N(x,y)+1;%設(shè)立閾值30,能量過(guò)大的反射,A和N恢復(fù)原值
if N(x,y)>100;
N(x,y)=100;
end
M(:)=N(12:211,12:211);
pause(1);
M=Z+M-100;
imshow(M,[min(min(M)),max(max(M))]);
end
end
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -