Rotate Basis Vectors Programmatically

I have six 6-dimensional basis vectors, i.e., that are orthogonal. I wonder how I can rotate these 6 vectors programatically in the 6D space to build new basis vectors. In other words, is there a way to parameterize these basis vectors so that I can change them without losing orthogonality?
A = [a1,a2,...,a6];
B = [b1,b2,...,b6];
C = [c1,c2,...,c6];
D = [d1,d2,...,d6];
E = [e1,e2,...,e6];
F = [f1,f2,...,f6];
Thank you.

 Respuesta aceptada

Jan
Jan el 30 de Sept. de 2022

0 votos

See: FEX: Rotation Matrix This creates N-dimensional rotation matrices.

1 comentario

Mohammad MSBR
Mohammad MSBR el 1 de Oct. de 2022
Thank you, Jan.
The rotation matrix constructed in your suggested code works well. many thanks.

Iniciar sesión para comentar.

Más respuestas (2)

Chunru
Chunru el 30 de Sept. de 2022
Editada: Chunru el 30 de Sept. de 2022
V1 = orth(randn(6)) % your original orthonormal basis
V1 = 6×6
-0.4706 0.7349 -0.0145 0.2908 -0.2682 0.2859 -0.3058 -0.0469 0.1456 0.2725 -0.2311 -0.8692 -0.0524 -0.3243 0.7312 0.0009 -0.5190 0.2967 -0.2590 0.3046 0.5051 -0.5918 0.4612 -0.1489 -0.7004 -0.4887 -0.0798 0.2369 0.3948 0.2287 -0.3532 -0.1447 -0.4272 -0.6594 -0.4865 -0.0169
% Then you can apply any other orthonormal basis to it
% For example,
V2 = orth(randn(6)); % get another orthonormal basis
Vnew = V2*V1; % this is the transform of the original orthonormal basis
Vnew*Vnew' % to demonstrate the oorthonormal property
ans = 6×6
1.0000 0.0000 0.0000 -0.0000 -0.0000 -0.0000 0.0000 1.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 -0.0000 1.0000 0.0000 0.0000 0.0000 -0.0000 0.0000 0.0000 1.0000 -0.0000 -0.0000 -0.0000 0.0000 0.0000 -0.0000 1.0000 -0.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000 1.0000
% If you want to control the rotation with angle in N-D space
% Rotate on hyperplane i-j by theta
i=2; j=4; % for example
theta = 5; % deg
R = eye(6); % 6D
R([i j], [i j]) = [cosd(theta) -sind(theta); sind(theta) cosd(theta)]
R = 6×6
1.0000 0 0 0 0 0 0 0.9962 0 -0.0872 0 0 0 0 1.0000 0 0 0 0 0.0872 0 0.9962 0 0 0 0 0 0 1.0000 0 0 0 0 0 0 1.0000
% Then you can have a series of rotation matrices and you can put them
% together as one rotation matrices

5 comentarios

Mohammad MSBR
Mohammad MSBR el 30 de Sept. de 2022
Thank you.
While your suggestion is good, it changes the original orthonormal set completely. I wonder if there is any approach so that the set is mroe continuously changed, something similar to a rotation matrix in 3D? If so, I can choose and control to rotate the orthonormal set for a small amount or large.
Thanks again.
Chunru
Chunru el 30 de Sept. de 2022
See the update answer.
Mohammad MSBR
Mohammad MSBR el 1 de Oct. de 2022
Does this approach work for a general R matrix? Your R matrix is an eye matrix, and therefore rotating it still stays orthogonal.
For example:
V1 = orth(rand(6));
dot(V1(1,:),V1(:,2)) % orthogonality test before rotation
%% Rotation
i=2; j=4; % for example
theta = 5; % deg
R = [cosd(theta) -sind(theta); sind(theta) cosd(theta)];
However, what is the general way to rotate a 6D orthogonal basis?
All of the following violate orthogonality:
1) V2 = V1;
V2([i j], [i j]) = R;
2) V2([i j], [i j]) = R*V1([i j], [i j]) ;
3) R = eye(6);
R([i,j],[i,j]) = [cosd(theta) -sind(theta); sind(theta) cosd(theta)];
V2 = R*V1;
I appreciate you pointing me to what I am missing. Thank you.
Chunru
Chunru el 2 de Oct. de 2022
Rotation on any hyper plane will not change orthogonity.
Mohammad MSBR
Mohammad MSBR el 2 de Oct. de 2022
Correct.

Iniciar sesión para comentar.

Mohammad MSBR
Mohammad MSBR el 30 de Sept. de 2022

0 votos

Thank you both for very helpful information.
The only missing point is the order of rotations. For a 6D space, I have 6 rotattions. Is there a way to pick a sequence without losing generality?
In other words, can I lead to the same beses by starting with rotations in different hyperplanes, or does starting with a specific hyperplane always lead to a unique configuration?
Thank you so much.

4 comentarios

Jan
Jan el 30 de Sept. de 2022
I do not understand this question. If you specify a hyperplane to rotate in and the rotational angle, the rotation matrix is unique. There is no order of rotations.
There is an infinite number of rotations in 6D, not just 6. Even rotations around the unit vectors are not meaningful for more than 3 dimensions, because there is not unique rotational axes. Therefore planes are required and the 6 unit vectors build 30 planes.
Mohammad MSBR
Mohammad MSBR el 1 de Oct. de 2022
Thank you. Now, I understand your explanation better.
Therefore, for me to rotate each hyperplane for 10 degrees, I need to pick their corresponding axes and perform a 10 deg rotation.
Is there a systematic way to iterate through all the 30 plane combinations?
Thank you!
Sorry, there are only 15 hyperplanes in 6D: 6 choices for the first vector, 5 possible choices for the 2nd one, but the order does not matter, so divide by 2.
nchoosek(1:6, 2)
ans = 15×2
1 2 1 3 1 4 1 5 1 6 2 3 2 4 2 5 2 6 3 4
Mohammad MSBR
Mohammad MSBR el 2 de Oct. de 2022
Thank you.

Iniciar sesión para comentar.

Categorías

Productos

Versión

R2022b

Preguntada:

el 30 de Sept. de 2022

Comentada:

el 2 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by