Find a new ortonormal coordiante vectors with a point and vector given

1 visualizzazione (ultimi 30 giorni)
Hi, for an university problem, I have to find a new tern with the origin in the point P1=[2 2 1], the z axis oriented along the vector N=[1 1 2] and with the x and y axes belonging to the plane passing through point P1 and identified from the normal N. I also have to make it's graphic representation, with red color for the x axis, green for y and blue for z. All that I can manage to do was using null space
clc;
clear all;
P1=[2 2 1];
N=[1 1 2];
VN=N/norm(N);
BVN=null(VN);
NV=[BVN(:,1) BVN(:,2) VN'];
  8 Commenti
Federico Cotugno
Federico Cotugno il 18 Giu 2022
I tried this but obv is not right
clc;
clear all;
N=[1 1 2];
VN=N/norm(N);
BVN=null(VN);
a=[1 1 1]
NV=[BVN(:,1) VN' BVN(:,2) a'];
q=[1 0 0 1;0 1 0 2;0 0 1 2;0 0 0 1]
t=NV';
b=q*t;
B=b';
Q=[b(:,1),b(:,2),b(:,3)];
plot3(Q(:,1),Q(:,2),Q(:,3));
Federico Cotugno
Federico Cotugno il 18 Giu 2022
Also tried this,it seems a bit better but i don't think is good
clc;
clear all;
N=[1 1 2];
VN=N/norm(N);
BVN=null(VN);
NV=[BVN(:,1),BVN(:,2),VN'];
P1=[2 2 1];
NV1=P1.*NV;
T=NV1';
plot3(T(:,1),T(:,2),T(:,3))

Accedi per commentare.

Risposte (1)

Brahmadev
Brahmadev il 26 Set 2023
Hi Federico,
I understand that you would like to get two vectors normal to the given vector originating at P1 = [2 2 1] towards N = [1 1 2]. If we assume a random vector, say, towards N1 = [1 1 3] from P1, we can get their cross-product to find a vector that is normal to P1N. If we further take the cross-product of P1N and P1N1, we can get the third vector which will be normal to both these vectors. This can be chosen as our third co-ordinate axes.
Further, "quiver3" can be used to plot these vectors and it's "LineSpec" can be used to set the color or the lines as you mentioned.
You can refer to the following documentation to know more about “quiver3” function:
Hope this helps in solving your issue.

Community Treasure Hunt

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

Start Hunting!

Translated by