How I can fix this problem
3 views (last 30 days)
Show older comments
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
~~~~~~~
0 Comments
Answers (1)
VBBV
on 8 Nov 2021
Edited: VBBV
on 8 Nov 2021
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 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!