How to obtain orthogonal (not orthonormal) vectors from "orth" or "qr"?

29 views (last 30 days)
Suppose there is a set of vectors v1, v2, v3, v4 with V=[v1, v2, v3, v4]. The vectors have very large number of data points ~ 100k. I wanted to orthogonalize them with each other. The classical Gram-Schmidt is not recommended by majority of authors for real data. The symbolic version of orth has skipnormalization. https://www.mathworks.com/help/symbolic/orth.html, but it does not work on orth(V). Error using orth Too many input arguments.
What would be the best way to generate orthogonal basis vectors rather orthonormal basis vectors using built in MATLAB functions? Thanks.
  12 Comments
Paul
Paul on 12 Dec 2021
I'm still not getting it, and I'm perhaps now even more confused.
We have a vector m of dimension 2000 x 1.
We have three vectors b1, b2, b3. Are these also of dimension 2000 x 1?
We can compute an orthonormal basis for the range space of B = [b1 b2 b3]. Those basis vectors are the colums of Q = orth(B). Q = [q1 q2 q3]. I assume that's what is meant by "orthonomalize b1, b2, and b3."
Now, we bring a new aspect into the discussion: " "orthogonalize" m with respect to the three orthonormal b's." Does this mean you want to find the component of m that is orhogonal to b1, b2, and b3? In other words, do you want to find the vector w such that m can be expressed as
m = w + a1*b1 + a2*b2 + a3*b3 where dot(b1,w) = 0, dot(b2,w) = 0, and dot(b3,w) = 0, and a1, a2, a3 are scalars?
FW
FW on 12 Dec 2021
You are right until "We can compute an orthonormal basis for the range space of B = [b1 b2 b3]. Those basis vectors are the colums of Q = orth(B). Q = [q1 q2 q3]. I assume that's what is meant by "orthonomalize b1, b2, and b3."
Now, take m, and orthogonalize m, with respect to q1, q2, q3 to obtain another vector u. This implies dot(u, q1) = dot(u,q2)=dot(u,q3) =0. However, u is not normalized. The length of u is taken as intensity.

Sign in to comment.

Answers (2)

Paul
Paul on 12 Dec 2021
I think this at least illustrates what you're trying to accomplish. It might not be (probably isn't) the best way
% generate some sample data
rng(100);
m = rand(1e5,1);
B = rand(1e5,3);
% verify that vectors bi are linearly independent
rank(B) == 3
ans = logical
1
% compute the desired result
Q = orth(B);
a = sum(m.*Q);
u = m - sum(a.*Q,2); % u is the component of m that is orthogonal to the bi and the qi
% verify that u is orthogonal to the bi
u.'*B
ans = 1×3
1.0e+-11 * -0.3567 -0.6558 -0.8104
%s show that u is also orthogonal to the qi
u.'*Q
ans = 1×3
1.0e+-13 * 0.3722 0.1427 0.2941
  3 Comments
Paul
Paul on 12 Dec 2021
The elements of a are the dot products of m with each qi.
Each column of a.*Q is the component of m in the direction of qi.
So u = m - sum(a.*Q,2) subtracts the sum of all of those components from m. What's left over, u, must therefore be the component of that is orthogonal to all the qi.
m is not orthogonal to the bi or the qi (did I say or imply that it is?). However, u is orthogonal to the bi (and the qi, of course).
Yes, I agree the dot product is relatively large, which is why I said this approach probably isn't the best way to solve the problem. I was just trying to illustrate a solution.
FW
FW on 12 Dec 2021
Edited: FW on 12 Dec 2021
Yes, I agree this probably isn't the best approach bc of large dot product. The classical method is working pretty well. As I said earlier, I was exploring built-in MATLAB functions. It seems there is none. Thanks for your effort.

Sign in to comment.


Muhammad Yasir
Muhammad Yasir on 6 May 2023
I want to compute the orthonal (not orthonormal) and schur stable components of the folloing matrix (A) and column vector (B)
A = [0 -0.80 -0.60; 0.80 -0.36 0.48; 0.60 0.48 -0.64];
B = [0.16; 0.14; 1];
Could somebody guide me, how can I perform these computations?
  1 Comment
Torsten
Torsten on 6 May 2023
Could you explain what this means ? What is the definition of
orthonal (not orthonormal) and schur stable components of the folloing matrix (A) and column vector (B)

Sign in to comment.

Categories

Find more on Linear Algebra in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!