matrix and its transpose matrix

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

Réponses (1)

Walter Roberson
Walter Roberson le 11 Nov 2020
Modifié(e) : Walter Roberson le 11 Nov 2020

0 votes

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 commentaires

for j=1:length(N)
That runs only once
Seahawks
Seahawks le 11 Nov 2020
But I need to set N = 10000 random matrices. Please advice.
Walter Roberson
Walter Roberson le 11 Nov 2020
Okay so you want N = 10000 random matrices. How does that connect to your 11 different signal to noise ratios? And when you plot, what size of output are you expecting?
Seahawks
Seahawks le 11 Nov 2020
My code generate 10000 matrices but could not find transpose H'
Walter Roberson
Walter Roberson le 11 Nov 2020
Good catch, Bruno, I have fixed that part.
Seahawks
Seahawks le 11 Nov 2020
The 10000 of 3x3 matrices. Size to plot 0:2:20
Walter Roberson
Walter Roberson le 11 Nov 2020
So for each of the entries in 0:2:20 you want to generate 10000 matrices that are 3 x 3 ? Are you expecting your output to be length(0:2:20) by 10000, or do you have code that somehow summarizes the results for each of the 10000 3 x 3 matrices into a single value?
For example are you finding the maximum absolute eigenvalue for each C, and your summary over the 10000 matrices is to find the largest absolute value out of the 10000 tries? To, in other words, summarize what the "worst case" (best case?) is?
Seahawks
Seahawks le 11 Nov 2020
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 le 13 Nov 2020
I found the way to do that. Thanks

Connectez-vous pour commenter.

Question posée :

le 11 Nov 2020

Commenté :

le 13 Nov 2020

Community Treasure Hunt

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

Start Hunting!

Translated by