Plotting a unit cell from a matrix

Hi everyone. I would like to plot a 3x3 matrix into a unit cell along with a 3-length vector. Each row of the matrix being a lattice vector. The matrix is like this:
Mcell = [ 4.85, 0.00, -0.02; 0.00, 8.41, -0.00; -1.67,-0.00, 4.87]
and the vector is like this:
Vect = [ 6.72e-01; 2.88e-01; -6.81e-01]
Please, how can I do it? Thank you very much from my heart for any suggestion. All the best.

댓글 수: 4

Rik
Rik 2017년 6월 23일
I have trouble understanding what you want. Do you mean you want to plot a wire-frame box with Mcell as corner vectors? and then add a vector to that same plot?
If so, you can use the matrix Mcell to generate a coordinate sequence you can plot with plot3. Then simply use hold on and quiver3 to add the vector.
Mma Kenya
Mma Kenya 2017년 6월 23일
Hi Rik Wisselink,
first of all, thank you, thank you, thank you, millions times, I do not know how to thank you again. Indeed, that is exactly I want to do: plot Mcell into a unit cell then add the vector in the same 3D plot. I tried what you explained to me, and it is well what I was looking for. But, the only "oops" is that when using plot3(Mcell) I have this (cell.pdf), the unit cell having some zigzags inside. How can I fix it by removing this zigzag? Thanks again Wisselink. Thank you very much. I really appreciate.
Rik
Rik 2017년 6월 26일
Plot3 will plot a continuous line, so you need to trick it. You can do this by plotting over itself, so you have to return to a previous point. If this doesn't help, show a MWE, so we can reproduce your plot and fix your problem.
Walter Roberson
Walter Roberson 2017년 6월 26일
plot and plot3 break the line when they encounter nan or inf.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2017년 6월 23일

댓글:

2017년 6월 26일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by