Generate an orthonormal matrix H mHxNh rank(H)=r

3 visualizzazioni (ultimi 30 giorni)
% Problem : Find an orthonormal matrix with dimension mH x nH and r=rank(H)
% We define orthonormal a matrix A(mH x nH) : A'*A=InH
clear; close all; clc
mH=5; nH=3; r=2;
% Case 1 mH>NH
A = rand(mH,nH);
V'*V % check orthonormality
% Caso 2 m<b: how to do ?
  3 Commenti
Domenico de Falco
Domenico de Falco il 11 Feb 2024
Modificato: Domenico de Falco il 11 Feb 2024
pardon Case 2: mH<nH: how to do ?
John D'Errico
John D'Errico il 12 Feb 2024
Surely you read my answer. I think you do not understand my answer though. I'll explain what happens when mH<nH in that answer.

Accedi per commentare.

Risposta accettata

John D'Errico
John D'Errico il 10 Feb 2024
Modificato: John D'Errico il 12 Feb 2024
Seems trivial enough. Not possible, at least not for this case. But trivially not possible.
mH=5; nH=3; r=2;
So a 5x3 array, of rank 2. That part is trivial. HOWEVER, what is NOT possible is for the product A'*A to result in an identity matrix. NOT possible, EVER. For example...
A1 = randn(5,2); A2 = randn(2,3);
A = A1*A2;
A has rank 2, because it is the product of two rank 2 random matrices.
ans = 2
Now trivially, we can orthogonalize the columns of A.
Aorth = orth(A)
Aorth = 5×2
-0.8498 -0.3246 0.2709 0.2936 -0.4471 0.8382 -0.0130 0.0917 0.0661 0.3123
But, since A has rank only 2, there are only two basis vectors we can ever get out of it. They are orthogonal. But the product Aorth'*Aorth will be only a 2x2 identity, not a 3x3 identity.
ans = 2×2
1.0000 -0.0000 -0.0000 1.0000
Think about it. If the matrix A is of rank 2, then A'*A can never have rank more than 2. Sorry, but it is flat out impossible for the product to be a 3x3 identity matrix, which has rank THREE. Basic linear algebra here.
Again, finding a 5x3 matrix of rank 2, this is easy enough. Then you can orthogonalize the columns trivially (just use orth). But since it has rank only 2, there will be only 2 columns in the result. As much as you want to do the mathematically impossible, the laws of linear algebra will get in your way.
Why was your code completely bogus? Simple enough.At the end, you do this:
% V'*V % check orthonormality
And of course it has the desired property, BUT, you did not use all the columns of V to build Anew. That is the flaw in your code, and why it is useless.
In the case of m<b, we have no clue, since you don't tell us what m and b are, and how they impact this.
Edit: Apparently the question was about mH<nH. There is still a fundamental flaw in your goal.
Can you generate an array of size mH by nH, of rank r? Again, this is trivial to achieve. For example...
mH=3; nH=5; r=2;
So the array will have 3 rows, 5 columns. But rank will still be r. Again, the scheme is trivial. Just use a product of two matrices as I did before.
A1 = randn(mH,r); A2 = randn(r,nH);
A = A1*A2
A = 3×5
-1.2321 0.4063 -1.2326 2.9057 0.7508 1.1452 0.2425 2.1002 -3.8171 -0.7325 -0.3892 0.6921 0.4784 -0.0970 0.2056
ans = 1×2
3 5
ans = 2
So A is a 3x5 matrix, of rank 2. While we can orthogonalize the columns of A, the result will have only TWO independent, orthogonal basis vectors. You CANNOT, EVER have more than 2 such basis vectors.
Aorth = orth(A)
Aorth = 3×2
0.6041 0.4588 -0.7966 0.3242 -0.0229 0.8273
Now, we can show the columns of Aorth are indeed orthonormal.
ans = 2×2
1.0000 -0.0000 -0.0000 1.0000
But again, it is trivially a flaw in your request, that Aorth CANNOT be mH by nH, so it cannot ever be 3x5. Again, just basic linear algebra. It is not a question of how I generated the matrices. There is no other scheme to generate the matrices.

Più risposte (0)


Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by