hi,
can help me in this error , i don't know the solution ?
and i want to sure if this equation is right for zero forcing estimator ?
N_r = 128 ;
K = 8 ;
H = zeros(N_r, K);
SNR_dB = -12:4:20;
SNR = 10.^(0.1.*SNR_dB);
for iter = 1:length(SNR)
S = sqrt((SNR(iter))/K).*dftmtx(K) ;
W_ZF = ((H.^H) .* (H .* (H.^H)).^(-1)) .* S ; %" error in this line , Arrays have incompatible sizes for this operation"
H_ZF = (W_ZF .^ H) .* y1 ;
end
Arrays have incompatible sizes for this operation.

5 commentaires

Dyuman Joshi
Dyuman Joshi le 16 Sep 2023
What is the size of variables H and S?
Maha Saif
Maha Saif le 16 Sep 2023
edit above
Dyuman Joshi
Dyuman Joshi le 16 Sep 2023
Undefined parameter iter in your code.
Check above.
Maha Saif
Maha Saif le 16 Sep 2023
ok
but the problem of "Arrays have incompatible sizes for this operation"
how can solve?
Maha Saif
Maha Saif le 16 Sep 2023
iter is a for loop

Connectez-vous pour commenter.

 Réponse acceptée

Maha Saif
Maha Saif le 24 Sep 2023

0 votes

this the right answer of code function
function H_ZF = ZF_receiver ( W_ZF , H , Y , S )
N_r = 128 ;
K = 10 ;
H = zeros (N_r , K) ;
SNR_dB = -12:4:25;
SNR = 10.^(0.1.*SNR_dB);
for iter = 1:length(SNR)
S = sqrt((SNR(iter))/K).*dftmtx(K); % pilot matrix
end
Hh = H' ;
%W_ZF = ((H.^H) .* (H .* (H.^H)).^(-1)) .* S ;
W_ZF = H * pinv(Hh*H) * S ;
H_ZF = W_ZF .* Y ;
%H_ZF = (W_ZF .^ H) .* y1 ;
H_est_zf = reshape (H_ZF , N_r , K );
end

Plus de réponses (2)

Walter Roberson
Walter Roberson le 16 Sep 2023
W_ZF = ((H.^H) .* (H .* (H.^H)).^(-1)) .* S ;
The first part of that expression results in a 128 x 8 array that is all infinity -- with H being all 0, the H .* gives all 0 and all-zero ^-1 is going to be all infinity.
S is 8 x 8.
You cannot use element-by-element multiplication between a 128 x 8 matrix and an 8 x 8 matrix.
You could potentially use * matrix-multiplication between a 128 x 8 matrix and an 8 x 8 matrix, giving a 128 x 8 result. Which will probably be entirely complex-NaN due to the infinities in the left-hand side...

4 commentaires

Maha Saif
Maha Saif le 17 Sep 2023
so , what can i do ?
how solve it ?
and the values of N and K are variables
Walter Roberson
Walter Roberson le 17 Sep 2023
I do not have any idea what the equations are for zero forcing receiver.
Maha Saif
Maha Saif le 17 Sep 2023
i mean how i can do multiplication in this case
N_r = 128 ;
K = 8 ;
H = zeros(N_r, K);
SNR_dB = -12:4:20;
SNR = 10.^(0.1.*SNR_dB);
numSNR = length(SNR);
W_ZF = cell(numSNR,1);
H_ZF = cell(numSNR,1);
for iter = 1:numSNR
S = sqrt((SNR(iter))/K).*dftmtx(K) ;
W_ZF{iter} = ((H.^H) .* (H .* (H.^H)).^(-1)) * S ;
H_ZF{iter} = (W_ZF{iter} .^ H) .* y1 ;
end
Unrecognized function or variable 'y1'.
However, I have no idea whether the modified expression is a correct expression for zero forcing receiver.
And it's still going to be all complex nan and inf anyhows. The matrix of zeros raised to power -1 is going to produce all infinities, and when you start manipulating infinities nan are a very common result.

Connectez-vous pour commenter.

Maha Saif
Maha Saif le 17 Sep 2023

0 votes

Does it make any difference if the H matrix is complex or has zeros or ones ?

1 commentaire

I had to guess about the size and values of y1 and about what might be reasonable "complex" entries.
If you have even a single zero entry in H then you get a NaN output -- at least for the corresponding row.
N_r = 128 ;
K = 8 ;
y1 = randi([0 1], N_r, K);
SNR_dB = -12:4:20;
SNR = 10.^(0.1.*SNR_dB);
numSNR = length(SNR);
H_ZF0 = cell(numSNR,1);
H_ZF1 = cell(numSNR,1);
H_ZFc = cell(numSNR,1);
H0 = zeros(N_r, K);
H1 = ones(N_r, K);
Hc = ones(N_r, K) * (1+1i); Hc(1,1) = 0;
for iter = 1:numSNR
S = sqrt((SNR(iter))/K).*dftmtx(K) ;
W_ZF = ((H0.^H0) .* (H0 .* (H0.^H0)).^(-1)) * S ;
H_ZF0{iter} = (W_ZF .^ H0) .* y1 ;
W_ZF = ((H1.^H1) .* (H1 .* (H1.^H1)).^(-1)) * S ;
H_ZF1{iter} = (W_ZF .^ H1) .* y1 ;
W_ZF = ((Hc.^Hc) .* (Hc .* (Hc.^Hc)).^(-1)) * S ;
H_ZFc{iter} = (W_ZF .^ Hc) .* y1 ;
end
H_ZF0{1}(1:5,:)
ans =
NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi
H_ZF1{1}(1:5,:)
ans = 5×8
0.7105 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.7105 0 0 0 0 0 0 0 0.7105 0 0 0 0 0 0 0
H_ZFc{1}(1:5,:)
ans =
NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi NaN + NaNi 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.0000 + 0.0000i 0.1067 - 1.0967i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.0000 + 0.0000i 0.0000 + 0.0000i -0.0000 + 0.0000i 0.1067 - 1.0967i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by