How to generate random projection matrices?

8 ビュー (過去 30 日間)
Rufat Imanov
Rufat Imanov 2019 年 7 月 24 日
編集済み: Bruno Luong 2019 年 7 月 26 日
As it is said in the question, I am looking for a Matlab function that generates random projection matrices, so that I can use it for linear programming.

回答 (3 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 7 月 24 日
編集済み: KALYAN ACHARJYA 2019 年 7 月 24 日
function P=projection_mat(n)
A=colbasis(magic(n));
P=A*inv(A'*A)*A';
end
The colbasis function is here
Here n represent size of square matrix. Please note that I have answered this question from here
Command Window:
>> y=projection_mat(6)
y =
0.7500 -0.0000 0.2500 0.2500 -0.0000 -0.2500
-0.0000 1.0000 0.0000 -0.0000 -0.0000 0.0000
0.2500 0.0000 0.7500 -0.2500 -0.0000 0.2500
0.2500 -0.0000 -0.2500 0.7500 -0.0000 0.2500
-0.0000 -0.0000 -0.0000 -0.0000 1.0000 -0.0000
-0.2500 0.0000 0.2500 0.2500 -0.0000 0.7500
You can generate any size matries, just pass the same size matrix to colbasis function.
Hope it helps!
  4 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 7 月 25 日
編集済み: KALYAN ACHARJYA 2019 年 7 月 25 日
Is there any necessity having fixed size matrices?
>> y=projection_mat(6)
y =
0.7500 -0.0000 0.2500 0.2500 -0.0000 -0.2500
-0.0000 1.0000 0.0000 -0.0000 -0.0000 0.0000
0.2500 0.0000 0.7500 -0.2500 -0.0000 0.2500
0.2500 -0.0000 -0.2500 0.7500 -0.0000 0.2500
-0.0000 -0.0000 -0.0000 -0.0000 1.0000 -0.0000
-0.2500 0.0000 0.2500 0.2500 -0.0000 0.7500
>> y=projection_mat(5)
y =
1.0000 -0.0000 -0.0000 -0.0000 -0.0000
-0.0000 1.0000 -0.0000 -0.0000 -0.0000
-0.0000 -0.0000 1.0000 -0.0000 0.0000
-0.0000 -0.0000 -0.0000 1.0000 0.0000
-0.0000 -0.0000 -0.0000 -0.0000 1.0000
>>
Rufat Imanov
Rufat Imanov 2019 年 7 月 25 日
yes, the size of matrix should be the same, but the matrix by itslef needs to change. Beacuse, I am working on finding a specific matrix that can project a square into square, so that the nodes/edges are not outside of the boundary of the square.

サインインしてコメントする。


Bruno Luong
Bruno Luong 2019 年 7 月 25 日
編集済み: Bruno Luong 2019 年 7 月 25 日
n = 5
r = 3; % rank, dimension of the projection subspace
[Q,~] = qr(randn(n));
Q = Q(:,1:r);
P = Q*Q' % random projection matrix P^2 = P, rank P = r
  5 件のコメント
Bruno Luong
Bruno Luong 2019 年 7 月 25 日
編集済み: Bruno Luong 2019 年 7 月 25 日
Sorry I think the only projection matrix that is orthogonal is diagonal matrix with 1 or 0 on the diagonal. So there is no really randomness for what you ask.
Bruno Luong
Bruno Luong 2019 年 7 月 26 日
編集済み: Bruno Luong 2019 年 7 月 26 日
I wonder if you mistaken "orthogonal projection matrix" and "projection matrix that is orthogonal". They are not the same.
Mine is "orthogonal projection matrix", which is projection matrix (P^2==P) that has additional properties
  1. symmetric
  2. all eigen values are 0 or 1.

サインインしてコメントする。


Image Analyst
Image Analyst 2019 年 7 月 25 日
Not sure what you mean by projection, but the radon transform does projections. That's its claim to fame. It basically projects a matrix along any angle and gives you the sum of the interpolated values along the projection angle. This is the crucial function for reconstructing 3-D volumetric CT images from 2-D projections.
The radon() function requires the Image Processing Toolbox.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by