This is my code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clear all
clc
for N=8:2:20
tn = 7;
M = 7; L = 5;
attSR = -40; attPU = -60; % dB
Nt = N;
h = zeros(Nt,M); % Nt antenna to M SRs
g = zeros(Nt,L); % Nt antenna to L PUs
for ii=1:M % to each SRs
h(:,ii) = (1/sqrt(1/attSR))* sqrt(1/2)*(randn(Nt,1)+1i*randn(Nt,1)) ;
H(:,:,ii) = h(:,ii)*h(:,ii)'; %before (7a) to 1 SR
end
for ii=1:L
g(:,ii) = (1/sqrt(1/attPU))* sqrt(1/2)*(randn(Nt,1)+1i*randn(Nt,1)) ;
G(:,:,ii) = g(:,ii)*g(:,ii)' ; %before (7a) to 1 PU
end
end
~~~~~~~

Antworten (1)

VBBV
VBBV am 8 Nov. 2021
Bearbeitet: VBBV am 8 Nov. 2021

1 Stimme

clear all
clear all
clc
i = 1;LL = 8:2:20;
for N=8:2:20
tn = 7;
M = 7; L = 5;
attSR = -40; attPU = -60; % dB
Nt = N;
h = zeros(Nt,M); % Nt antenna to M SRs
g = zeros(Nt,L); % Nt antenna to L PUs
H = zeros(Nt,Nt,length(LL));
G = zeros(Nt,Nt,length(LL));
for ii=1:M % to each SRs
h(:,ii) = (1/sqrt(1/attSR))* sqrt(1/2)*(randn(Nt,1)+1i*randn(Nt,1)) ;
%H(:,:,i) = h(:,ii)*h(:,ii)'; %before (7a) to 1 SR
end
H = h*h.';HH(1:Nt,1:Nt,i) = H;
for ii=1:L
g(:,ii) = (1/sqrt(1/attPU))* sqrt(1/2)*(randn(Nt,1)+1i*randn(Nt,1)) ;
%G(:,:,i) = g(:,ii)*g(:,ii)' ; %before (7a) to 1 PU
end;
G = g*g.';GG(1:Nt,1:Nt,i) = G;
i = i+1;
end
You can try this approach

2 Kommentare

VBBV
VBBV am 8 Nov. 2021
Check for HH and GG matrices which have the final results
Khiem Nguyen
Khiem Nguyen am 8 Nov. 2021
When i read your code. I really know my mistakes. I truly thanks you very much. Have a good day!!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Design, Analysis, Benchmarking, and Verification finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 8 Nov. 2021

Kommentiert:

am 8 Nov. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by