フィルターのクリア

generate orthogonal matrix function

8 ビュー (過去 30 日間)
mingcheng nie
mingcheng nie 2023 年 9 月 8 日
コメント済み: Bruno Luong 2023 年 9 月 8 日
Hi there,
Assume I have two square matrix A and B with the same size, I want to find a matrix that orthogonal to A but non-orthogonal to B, i.e., AC=0 and BC0, where C is the matrix I want.
Is there any function can generate it? I know null(A) can generate the orthogonal matrix of A, but I want to ensure it is non-orthogonal to B meanwhile.
Thanks,
  1 件のコメント
David Goodmanson
David Goodmanson 2023 年 9 月 8 日
編集済み: David Goodmanson 2023 年 9 月 8 日
Hi MN,
for this to work there will have to be restrictions on A and B. For example, A cannot be of full rank, because if it is, then it has and inverse, in which case AC = 0 --> C=0. So suppose A is not of full rank. Then B must have at least one row that is linearly independent of the rows of A, otherwise AC = 0 --> BC = 0.

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

回答 (1 件)

Bruno Luong
Bruno Luong 2023 年 9 月 8 日
編集済み: Bruno Luong 2023 年 9 月 8 日
I claim this returns the solution C that is orthogonal to A but not to B (meaning not to all of columns of B)
A = rand(5,4)*rand(4,5);
B = rand(5,4)*rand(4,5);
AO = null(A.');
ABO = null([A B].');
v = null(ABO'*AO);
if isempty(v)
fprintf('solution does not exist\n')
return
end
v1 = v(:,1);
[Q,~,~] = qr([2*v1, eye(size(AO,2))]);
C = AO*Q
C = 5×1
0.3321 0.1400 -0.5466 -0.1237 0.7457
% Check
norm( A'*C, 'fro')
ans = 2.3876e-16
norm( B'*C, 'fro')
ans = 1.8113
  3 件のコメント
Bruno Luong
Bruno Luong 2023 年 9 月 8 日
Thanks I fix it just a small detail, my algo supposes to work with non-square and square matrices
Bruno Luong
Bruno Luong 2023 年 9 月 8 日
To get the orthogonal of rows A, B, change the first two statements
A = rand(5,4)*rand(4,5);
B = rand(5,4)*rand(4,5);
AO = null(A); % change
ABO = null([A; B]); % change
v = null(ABO'*AO);
if isempty(v)
fprintf('solution does not exist\n')
return
end
v1 = v(:,1);
[Q,~,~] = qr([2*v1, eye(size(AO,2))]);
C = AO*Q
C = 5×1
0.4633 -0.2224 -0.6358 -0.4591 0.3476
% Check
norm( A*C, 'fro')
ans = 4.2999e-16
norm( B*C, 'fro')
ans = 1.5602

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

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by