⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stemcon.m

📁 扫描电镜(stem)的matlab模拟程序代码
💻 M
字号:
function II = stemcon()
%  STEMCON Simulate an ADF image using the incoherent imaging model
%  calls  stempsf2d.m, stempot.m
%
%  started 10-Apr-1997 David Muller (based on EJK's stemhr)
%  modifed 07-Jul-2006 Huolin Xin
 
disp( 'stemcon: Simulate an ADF image using the incoherent imaging model' );
%
kev  = input( 'Type electron energy in keV :');
Cs   = input( 'Type spherical aberation Cs in mm :');
df   = input( 'Type defocus df in Angstroms :');
amax = input( 'Type objective aperture semiangle in mrad :');
d0   = input( 'Type source size in Angstroms :');

rmax = input( 'Type size of slice in Angstroms:');
nx = input( 'Type number of pixels in slice:');

option = input ('1 - Coordinates file; 2 - image file : ');
if option == 1
    potfile = input( 'Type name of coordinates file(e.g. si7x5.xyz) : ','s');
    V = stempot(rmax,rmax,nx,nx,potfile);    
elseif option == 2
    potfile = input( 'Type name of the image file(e.g. random.tif) : ','s');
    V = double(imread(potfile));
end

dx = rmax/nx;
x = -rmax/2:dx:rmax/2-dx;
imagesc(x,x,V);
axis( [ -rmax/2 rmax/2 -rmax/2 rmax/2 ] );
axis square;
xlabel( 'Position in Angstroms');
title('Projected Potential');
colormap(hot); 
colorbar;
figure;

wav = 12.3986/sqrt((2*511.0+kev)*kev);  % electron wavelength
%
ir = 1:nx;
dr = rmax/nx;

%Bandwidth limit 
fmax = rmax/2 * 2/3;
[rx,ry] = meshgrid( -rmax/2:dr:(rmax/2)-dr);
%wid = (sqrt( rx.^2 + ry.^2 ) < fmax );
clear rx,ry;
%wid = fftshift(wid);
ry = -rmax/2:dr:(rmax/2)-dr;

param.Cs   = Cs;
param.df   = df;
param.kev  = kev;
param.amax = amax;
param.d0=d0;

psf = fft2(stemhr2d( rmax, nx, param));
%psf = fft2(stemhr2d( rmax, nx, param)).* wid;
%clear wid;

V = fft2(V);
%V = fft2(rand(nx,nx));
%V=double(imread(fdfdf));

II = ifft2( psf .* V );
% clear and reuse inputs to reduce memory/fragmentation
clear psf;
V = real( II );
II = fftshift( V );


imagesc( ry,ry, II );
colormap(hot);
axis( [ -rmax/2 rmax/2 -rmax/2 rmax/2 ] );
axis square;
xlabel( 'Position in Angstroms');
colorbar;
s1 = sprintf('STEM Cs= %gmm, df= %gA, E= %gkeV, ', Cs, df, kev);
s2 = sprintf('OA= %gmrad, d0=%gA', amax,d0);
title([potfile ' ' s1 s2]);

filename = [potfile ' STEM' ' rmax=' num2str(rmax) 'A' ' ' s1 s2 '.jpg'];
print('-djpeg90',filename);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -