How to remove and replace single arrow using quiver3/arrow3d
2 views (last 30 days)
Show older comments
Hi,
I have a 4x4x4 lattice which within it has 16 sites which stores in a cell array a vector at each of these sites, which can point in one of 4 directions.
z1 = (1/sqrt(3))*[1;1;1];
z2 = (1/sqrt(3))*[1;-1;-1];
z3 = (1/sqrt(3))*[-1;-1;1];
z4 = (1/sqrt(3))*[-1;1;-1];
I want to make a plot of these "spins" so I run a for loop which goes through the lattice and draws an arrow using arrow3d based on if conditions i.e
if isequal(latticec{i,j,k},-z1)==1)
arrow3d([i+z1(1)/1.5,i-z1(1)/1.5],[j+z1(2)/1.5,j-z1(2)/1.5],...
[k+z1(3)/1.5,k-z1(3)/1.5],0.9,0.05,0.1,'Blue');
elseif isequal(latticec{i,j,k},z1)==1)
arrow3d([i-z1(1)/1.5,i+z1(1)/1.5],[j- z1(2)/1.5,j+z1(2)/1.5],...
[k-z1(3)/1.5,k+z1(3)/1.5],0.9,0.05,0.1,'Red');
and so on for the other 4 vectors. I do it this way because I want basically the middle of the arrow to be at the x,y,z location of the lattice site.
My program then runs through the lattice and picks out a random x,y,z coordinate of the lattice. I flip the value of the vector in the cell array and I want to now draw the arrow so that it has been flipped. But I don't want to run through the whole loop again because I want to scale my lattice to bigger sizes and this would not be efficient. I was instead thinking is there a way to delete just the arrow at that certain point and replace it with an arrow pointing in the opposite direction.
If you can do it using quiver3 thats o.k. I just prefer arrow3d because the visual image is a lot nicer.
Edit: I have decided to use quiver3 because it's too taxing to use arrow3d.
0 Comments
Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!