Simulación de la celda BCC



% Programa para Simular una celda unitaria cristalina BCC en Matlab
% Program to draw a BCC in Matlab
% Diseñado por Juan José Reyes Salgado
clear
[x,y,z] = sphere(20);
n=2.5;
surf(x/n,y/n,z/n,'FaceColor','none','EdgeColor',[0 0 1])
hold on
% Atoms in corner
surf(x/n+1,y/n,z/n,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n,y/n+1,z/n,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n+1,y/n+1,z/n,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n+1,y/n,z/n+1,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n,y/n+1,z/n+1,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n+1,y/n+1,z/n+1,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n,y/n,z/n+1,'FaceColor','none','EdgeColor',[0 0 1])
% Atoms in body
surf(x/n+.5,y/n+.5,z/n+.5,'FaceColor','none','EdgeColor',[1 0 0])
% Draw the outer lines of cube
x2=[0 1 1 0 0 0 1 1 0 0 1 1 1 1 1 0 0];
y2=[0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 1 1];
z2=[0 0 0 0 0 1 1 1 1 1 1 0 0 1 0 0 1];
plot3(x2,y2,z2,'k','linewidth',3)
% To draw a plane to intercept atoms
%x1=[1 0 0 1];
%y1=[0 1 0 0];
%z1=[0 0 1 0];
%plot3(x1,y1,z1,'k','linewidth',3)
axis equal
grid on




celda_BCC.png









Simulación de la celda FCC


% Programa para Simular una celda unitaria cristalina FCC en Matlab
% Program to draw a FCC in Matlab
% Diseñado por Juan José Reyes Salgado
clear
[x,y,z] = sphere(20);
n=3;
surf(x/n,y/n,z/n,'FaceColor','none','EdgeColor',[0 0 1])
hold on
% Atoms in corner
surf(x/n+1,y/n,z/n,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n,y/n+1,z/n,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n+1,y/n+1,z/n,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n+1,y/n,z/n+1,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n,y/n+1,z/n+1,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n+1,y/n+1,z/n+1,'FaceColor','none','EdgeColor',[0 0 1])
surf(x/n,y/n,z/n+1,'FaceColor','none','EdgeColor',[0 0 1])
% Atoms in face
surf(x/n+.5,y/n+.5,z/n,'FaceColor','none','EdgeColor',[1 0 0])
surf(x/n+.5,y/n+.5,z/n+1,'FaceColor','none','EdgeColor',[1 0 0])
surf(x/n+.5,y/n,z/n+.5,'FaceColor','none','EdgeColor',[1 0 0])
surf(x/n,y/n+.5,z/n+.5,'FaceColor','none','EdgeColor',[1 0 0])
surf(x/n+.5,y/n+1,z/n+.5,'FaceColor','none','EdgeColor',[1 0 0])
surf(x/n+1,y/n+.5,z/n+.5,'FaceColor','none','EdgeColor',[1 0 0])
% Draw the outer lines of cube
x2=[0 1 1 0 0 0 1 1 0 0 1 1 1 1 1 0 0];
y2=[0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 1 1];
z2=[0 0 0 0 0 1 1 1 1 1 1 0 0 1 0 0 1];
plot3(x2,y2,z2,'k','linewidth',3)
% To draw a plane to intercept atoms
%x1=[1 0 0 1];
%y1=[0 1 0 0];
%z1=[0 0 1 0];
%plot3(x1,y1,z1,'k','linewidth',3)
axis equal
grid on

celda_FCC.png