フィルターのクリア

generate multi Diagonal matrices

2 ビュー (過去 30 日間)
Seahawks
Seahawks 2020 年 11 月 10 日
編集済み: Setsuna Yuuki. 2020 年 11 月 10 日
I need help. I have beable to generate 100 of random matrices H. then try to get S diagonal matrix but it is not succesful as both s11=0, s22=0, however s33 value is correct.
N = 100;
for j=1:length(N)
H = 0.5.*(randn(3,3, N) +(1i) * randn(3,3, N));
for k=1:length(H)
[S(3,3,k)]= svd(H(3,3,k));
%[U(3,3,k),S(3,3,k),V(3,3,k)]= svd(matrices(3,3,k));
end
end
H(:,:,92) =
-0.3382 + 0.3345i 0.1304 + 0.0842i -0.4230 + 0.3986i
0.0729 - 0.5495i -0.3290 - 0.2820i -0.2131 - 0.1437i
0.3096 + 0.0466i 0.0022 - 0.3723i -0.2904 - 0.0265i
S(:,:,92) =
0 0 0
0 0 0
0 0 0.2916
Please advise
Thanks

回答 (2 件)

Setsuna Yuuki.
Setsuna Yuuki. 2020 年 11 月 10 日
In your code, you are only calculating the svd of the column 3 and row 3.
N = 100;
for j=1:length(N)
H = 0.5.*(randn(3,3, N) +(1i) * randn(3,3, N));
for k=1:length(H)
[S(1,1,k)]= svd(H(1,1,k)); % row 1 column 1
[S(2,2,k)]= svd(H(2,2,k)); % row 2 column 2
[S(3,3,k)]= svd(H(3,3,k)); % row 3 column 3
%[U(3,3,k),S(3,3,k),V(3,3,k)]= svd(matrices(3,3,k));
end
end
  2 件のコメント
Seahawks
Seahawks 2020 年 11 月 10 日
Thanks a lot. It works.
Setsuna Yuuki.
Setsuna Yuuki. 2020 年 11 月 10 日
編集済み: Setsuna Yuuki. 2020 年 11 月 10 日
Accept my answer please :D
Accept my answer please :D

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


Christine Tobler
Christine Tobler 2020 年 11 月 10 日
The SVD is usually computed for a matrix, but you're only passing in a scalar on each call.
Is it possible you meant to pass in a page H(:, :, k) (which would be a 3-by-3 matrix) in every iteration?

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by