Question

In: Physics

At each position in a 3D grid lies an atom with a positive or negative spin,...

At each position in a 3D grid lies an atom with a positive or negative spin, specified by values +1 and -1, respectively. The spin value at each position is assigned randomly based on whether a randomly generated number is greater than or less than 0.5. I need to plot a 3D visualization of this grid using MATLAB in which positive spin locations are represented by markers of one color and negative spin locations are another color.

Solutions

Expert Solution

I have written the corresponding matlab script below,

If you want to change the marker color, size or shape visit the fallowing link,

https://in.mathworks.com/help/matlab/ref/plot3.html

-----------------------------------------------------------------------------------------

xn = 3; % length of lattice in x-direction
yn = 3; % length of lattice in y direction
zn = 3; % length of lattice in y direction
%%
%Section 1
figure(1)
% plotting lattice points
ms = 500; % Marker size
for i = 1:xn;
for j = 1:yn;
for k = 1:zn;
rn = rand;
if rn < 0.5;
scatter3(i,j,k,ms,'o','r')
grid off
else
scatter3(i,j,k,ms,'o','b')
grid off
end
hold on
end
end
end
%%
% Section 2
% If you want to show the 3D grid lines, other wise just run the 1st
% section
  
for i = 1:xn;
for j = 1:yn;
xg = [];
for xm =1:xn
xg(xm)=i;
end
yg = [];
for ym =1:yn
yg(ym)=j;
end
plot3(xg,yg,1:zn,'k--','linewidth',1)
hold on
end
end

for i = 1:xn;
for j = 1:zn;
xg = [];
for xm =1:xn
xg(xm)=i;
end
zg = [];
for zm =1:zn
zg(zm)=j;
end
plot3(xg,1:yn,zg,'k--','linewidth',1)
hold on
end
end

for i = 1:yn;
for j = 1:zn;
zg = [];
for zm =1:zn
zg(zm)=j;
end
yg = [];
for ym =1:yn
yg(ym)=i;
end
plot3(1:xn,yg,zg,'k--','linewidth',1)
hold on
end
end


Related Solutions

use the atom builder lab to classify each atom description as positive ion, negative ion or...
use the atom builder lab to classify each atom description as positive ion, negative ion or neutral ion. 2 protons, 2 electrons, 2 neutrons, 3 protons, 3 electrons 3 neutrons, 3 protons 3 neutrons, 2 electrons, 1 proton, 0 neutron, 0 electron, 1 proton, 0 neutrons, 1 electrons, 1 proton, 1 neutron, 2 electrons.
Identify a real-life PR campaign that attempted to put a positive spin on an otherwise negative...
Identify a real-life PR campaign that attempted to put a positive spin on an otherwise negative situation; describe their efforts in sufficient detail to clarify your example. Please do not plagiarize. If you do not plagiarize, I will upvote. Thanks!
Write one example of each: Positive conformity: Negative conformity: Positive obedience: Negative obedience:
Write one example of each: Positive conformity: Negative conformity: Positive obedience: Negative obedience:
State whether each of the following is an example of a positive correlation or a negative...
State whether each of the following is an example of a positive correlation or a negative correlation. a. Higher education level is associated with a larger annual income. b. Increased testosterone is associated with increased aggression. c. The smaller the class size, the more students believe they are receiving a quality education. d. Rising prices of apples are associated with the sale of fewer apples.
Write the electron configurations and orbital spin diagrams for the neutral atom and the kon of...
Write the electron configurations and orbital spin diagrams for the neutral atom and the kon of the element having the atomic number 12. Based on this information explain the valence number of electrons in the elements responsible for the ion's charge.
What are positive and negative reinforcement? How are positive and negative reinforcement different? How are they...
What are positive and negative reinforcement? How are positive and negative reinforcement different? How are they similar? What is punishment?
Suppose that the collector is held at a small negative voltage with respect to the grid....
Suppose that the collector is held at a small negative voltage with respect to the grid. Will the accelerated electrons reach the collecting plate? Suppose that the collector is held at a small negative voltage with respect to the grid. Will the accelerated electrons reach the collecting plate? Yes, but only those electrons with energy less than the potential difference established between the grid and the collector will reach the collector. Yes, but only those electrons with energy greater than...
Predict whether the entropy change is positive or negative for each of the following reactions. a....
Predict whether the entropy change is positive or negative for each of the following reactions. a. 2KClO4(s) --> 2KClO3(s)+O2(g) b. H2O(g) --> H2O (l) c. 2Na(s)+2H2O(l)-->2NaOH(aq)+H2(g) d. N2(g)-->2N(g)
Describe and explain 'real life' examples of positive and negative punishment and positive and negative reinforcement...
Describe and explain 'real life' examples of positive and negative punishment and positive and negative reinforcement and give four examples of the schedules of reinforcement. Excellent essays will include an explanation of learning principles.
                         Positive       Negative Influenza A.       &n
                         Positive       Negative Influenza A.         360.              7 no influenza A.      6.               1110 find the probability of a subject with a positive test result given that the subject does have influenza A find the probability of selecting a subject with a negative test result given that the subject does not have influenza a
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT