How to plot a vector and line normal to vector
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi all,
I get the following results from a code:
Grain 2 dom. wall normal to [0.525 0.927 0.930 ], seen as lines || to: [0.870 -0.492 ]
Grain 2 dom. wall normal to [0.538 -1.065 0.759 ], seen as lines || to: [-0.893 -0.451 ]
My question is, how do you plot a vector, and how do you plot the line parallel to the normal of the vector? I have tried a couple of methods but can never seem to get it working properly.
Thanks in advance for any responses,
Tamsin
댓글 수: 0
채택된 답변
Bjorn Gustavsson
2020년 4월 16일
If you have a normal-vector to a plane and want to plot 2 vectors in the plane you could do something like this:
n = [n_x,n_y,n_z]; % your normal-vector;
e_r = randn(1,3);e_r = e_r/norm(e_r); % randomly selected unit-vector;
% You should put in some checks for e_r being || to n here...
e1 = cross(n,e_r);
e1 = e1/norm(e1);
e2 = cross(n,e1);% and normalize
Then you have 2 perpendicular vectors in the plane. Plot with any of the arrow-functions you find on the file-exchange, I alternate between arrow3 and arrow
HTH
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!