how to obtain the basis vector of the space orthogonal to K vectors?
4 views (last 30 days)
Show older comments
Hi,
I have Psi= [e1; e2; ... eK; ] having K (eigen vectors) rows, and need to find (N-K) basis vectors of the space orthogonal to K vectors. So that resultant, Psi_new= [e1; e2; ... eK; e(K+1); ... eN; ].
If K=4 and N=6. Then, for any e=[0.9999; 0.8294; 1.0173; 0.9973]; Psi=[e']; Further, I have to find (6-4=2) basis vectors.
basis=null(Psi(:).') result as
basis =
-0.4302 0.8781 -0.1495 -0.1465
-0.5276 -0.1495 0.8167 -0.1797
-0.5173 -0.1465 -0.1797 0.8238
which is not the required one. So, could anyone tell me what commands in matlab is useful to obtain the (N-K) basis vector of the space orthogonal to K vectors?
0 Comments
Accepted Answer
John D'Errico
on 20 Jul 2020
null is the tool to do exactly that.
2 Comments
John D'Errico
on 21 Jul 2020
NO. You need to use the function null. Read the help for null. Look at the examples. TRY IT.
For example, Consider the vectors in B.
B = rand(3,5)
B =
0.8892 0.7917 0.46752 0.91457 0.3652
0.66566 0.90643 0.91953 0.93016 0.78042
0.96681 0.068954 0.96643 0.86964 0.22151
They can be viewed as independent vectors spanning some 3-dimensional subspace of R^5. While they are not orthogonal, they could eaily be made so, using for example, a Gram-Schmidt orthogonalization. Or you could use just orth.
Since here we have a 5 dimensional space, and 3 vectors spanning some 3 dimensional subspace, then there is a subspace of dimension 5-2 that is orthogonal to this subspace. null provides us a basis for the nullspace.
N = null(B)
N =
-0.53286 0.25093
-0.19447 -0.43255
-0.15403 -0.44708
0.80335 0.063967
-0.09563 0.73889
>> B*N
ans =
-9.0206e-17 1.1102e-16
1.9429e-16 -1.1102e-16
9.3675e-17 1.6653e-16
As you see, to within floating point trash, they are orthogonal to the original set, and they form an orthogonal basis, again, to within floating point trash.
N'*N
ans =
1 -6.8656e-18
-6.8656e-18 1
Read the help for null. Look at the examples.
More Answers (0)
See Also
Categories
Find more on Performance and Memory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!