how to calculate a rotation matrix in $n$ dimensions given the point to rotate, an angle of rotation and an axis of rotation ($n-2$ subspace) I would like to calculate an $(n \times n)$ rotation matrix in the $n-dimensional$ space given the following:


*

*An angle of rotation.

*An axis of rotation (an $(n-2)$ subspace that passes through the origin given by $(n-2)$ unit vectors that span the subspace).


For $n=3$, I know how to do it. there's also a function in matlab that can do it for you (vrrotvec2mat).
But I don't know how to do it for $n>3$. I'm not even sure if there's a unique rotation matrix for this purpose. If there's more than one, I don't mind which rotation matrix to use.
My goal is eventually to write the implementation in matlab (or use an existing one if exists). But if anyone here can show me the mathematical way I will be able to translate it to matlab code.
Here's an example to what I need (for $4D$ since I already know how to do it for $3D$):
Say we have these two orthogonal vectors that span a plane in $4D$ (that passes through the origin):
$v_1$ = [-0.5601,    0.7248   -0.3440   -0.2064]
$v_2$ = [-0.7001   -0.3440    0.5700   -0.2580]
and say we have the angle $\theta=30^\circ$.
I want to calculate the rotation matrix $R$ that rotates any point by $\theta=30^\circ$ around the above plane.
Meaning, any point $p$ that I choose in $4D$, the new point $Rp$ will be $p$ rotated by $\theta=30^\circ$ around the above plane.
Thanks in advance!
 A: One strategy might be based on finding orthogonal complement ($n-2$ subspace) generated by orthonormal vectors $v_1,...,v_{n-2}$  (which is given in conditions of the task, but it can require to find orthonormal basis as it is not said that vectors are orthogonal only they are unit) to  2-dimensional subspace spanned by vectors $a,b$ representing initial and final point.    (WLOG let them be unit vectors, if not scale them appropriately).
In this 2-d subspace additionally we could have some unit vector $a_\perp$ which is orthogonal to initial vector $a$  and unit vector $b_\perp$ which is orthogonal to $b$ (two possibilities for $b_\perp$, one possibility should be eliminated with the use of angle of rotation - it should be the same between $a,b$ and between $a_\perp ,b_\perp $   ). 
Now we have two sets of orthogonal matrices with $n$ vectors $A=[a \ \ a_\perp \ \ v_1 \ \ \dots \ \ v_{n-2}]  $ and $B=[b \ \ b_\perp \ \ v_1 \ \ \dots \ \ v_{n-2}] $.
Then we have $B=RA$ and the searched rotation matrix $R=BA^{-1}$.
In case of doubts try to visualize this for 3-dimensional case and extend it for n-dimensional case.
