matrix and its transpose matrix

조회 수: 6 (최근 30일)
Seahawks
Seahawks 2020년 11월 11일
댓글: Seahawks 2020년 11월 13일
I have:
clc;clear;close all;
N = 10;
SNRdB=0:2:20;
SNR = 10.^(SNRdB/10);
P=2;
B = 1000;
I = 3;
for j=1:length(N)
A = 0.5.*(randn(3,3, N) +(1i) * randn(3,3, N));
end
C = log2(det(I + (P/N)*(A*A')));
figure(1)
semilogy(SNRdB,C_eigen,'ro-','lineWidth',.5);
receive error:
Error using '
Transpose on ND array is not defined. Use PERMUTE instead.
Error in matrix33e (line 12)
C = log2(det(I + (P/N)*(A*A')));
Please help
Thanks

답변 (1개)

Walter Roberson
Walter Roberson 2020년 11월 11일
편집: Walter Roberson 2020년 11월 11일
for j=1:length(N)
A = 0.5.*(randn(3,3, N) +(1i) * randn(3,3, N));
end
Why are you overwriting all of A in each loop iteration?
You are creating A as a 3 x 3 x 10 array each time.
C = log2(det(I + (P/N)*(A*A')));
Reminder: the * operator is only valid when one of the sides is a scalar, or both sides are either vectors or 2D arrays with the number of columns of the first operand being the same as the number of rows of the second operand. Your 3 x 3 x 10 array is not 2D so * cannot be used with it.
N = 10;
SNRdB=0:2:20;
[...]
semilogy(SNRdB,C_eigen,'ro-','lineWidth',.5);
I would suggest to you that you should not be assigning a constant N, and should instead be using
N = length(SNRdB);
I would further suggest to you that you should be using
for j=1:N
A = 0.5.*(randn(3,3) +(1i) * randn(3,3));
C = log2(det(I + (P/N)*(A*A')));
C_eigen(j) = something having to do with C
end
  댓글 수: 9
Seahawks
Seahawks 2020년 11월 11일
Each generate 10000 matrix to 10000 values. These 10000 values will go into C formula to plot with SNRdB. Hope it clear for you
Seahawks
Seahawks 2020년 11월 13일
I found the way to do that. Thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by