Throughput performance of OFDMA

for the below mentioned code i want to plot the number of subcarriers in x axis and throughput on yaxis.but for me its showing the number of users in x axis.can anyone help me to solve this issue.
Bmax=2000000;
noise=1e-9;
p_fix=0.01;
N_UE=[ 10 20 30 40 50];
N_SC=[ 60 70 80 90 100];
for r = 1:length(N_SC)
for t= 1 :length(N_UE)
Xmax=1; % x-coordinate for base station
Ymax=1; % y-coordinate for base station
radius=5; %coverage radius
xsd=ones(1,N_UE(t))*Xmax;
ysd=ones(1,N_UE(t))*Ymax;
rrx=radius*sqrt(rand(1,N_UE(t)));
thetarx=2*pi*rand(1,N_UE(t));
ang=0:0.01:2*pi;
xrx=xsd+rrx.*cos(thetarx); %random position of receivers-->x-coordinate
yrx=ysd+rrx.*sin(thetarx); %random position of receivers-->x-coordinate
th = 0:pi/100:2*pi;
xunit = radius * cos(th) + Xmax;
yunit = radius * sin(th) + Ymax;
ratio=0.1;
c=2*pi*ratio;
for j=1:N_UE(t)
temp=[];
for n=1:N_SC(r)
nc=(n-1)*c;
entry=(1+i*nc)/(1+nc^2);
temp=[temp entry];
end
Rchan=toeplitz(temp);
[E,L]=eig(Rchan);
SQRTL=sqrt(L);
A=E*SQRTL/sqrt(2);
GG=randn(N_SC(r), 1)+i*randn(N_SC(r),1);
H=A*GG;
HH=abs(H);
as=4;
bs=10;
Lsigma=as+(bs-as)*rand(1,N_UE(t));
Lshadow=10.^(randn(1,N_UE(t)).*(Lsigma/10));
ae=3;
be=5;
Lexp=ae+(be-ae)*rand(1,N_UE(t));
for k=1:N_SC(r)
for j=1:N_UE(t)
dist2(j)=sqrt((xrx(j)-xsd(j))^2+(yrx(j)-ysd(j))^2);
G(j,k)=(F(j,k)*Lshadow(j))/dist2(j).^Lexp(j);
end
end
siz = size(G);
idx = sub2ind(siz, randi([1,N_UE(t)], 1, siz(2)), 1:siz(2));
C = zeros(siz);
C(idx) = G(idx)
throughput =((Bmax.*log(1+((p_fix).*C))./noise));
overall_throughput = sum(sum((Bmax.*log(1+((p_fix).*C))./noise)));
output(r,t)=overall_throughput;
figure
plot(throughput,'b','linewidth',2);
legend(['No.of users=' num2str(N_UE(t))])
xlabel('No of subcarriers')
ylabel('throughput')
axis square
grid on
end
end
figure
plot(output(:,1), 'color', 'r' ,'linewidth',2);hold on
plot(output(:,2), 'color', 'b' ,'linewidth',2);hold on
plot(output(:,3), 'color', 'm' ,'linewidth',2);hold on
plot(output(:,4), 'color', 'y' ,'linewidth',2);hold on
plot(output(:,5), 'color', 'g' ,'linewidth',2);hold on
xlabel('No of subcarriers [x10]')
ylabel('Overall Throughput')
legend( 'UE1','UE2','UE3','UE4','UE5','Location','best')
grid on
title('Overall throughput performance')

Risposte (1)

Krishan Srimal
Krishan Srimal il 29 Gen 2018

0 voti

This is gives me an error. what would be the reason pls?
Attempt to execute SCRIPT throughput as a function: C:\Users\user\Documents\throughput.m
Error in throughput (line 4) plot(throughput,'b','linewidth',2);

3 Commenti

That message hints that you might have extracted a small portion of the code from above and missed putting in the line
throughput =((Bmax.*log(1+((p_fix).*C))./noise));
The message also hints that you tried to store your short bit of code in throughput.m while trying to use throughput as a variable name: that tends to lead to confusion and bugs.
You will probably need to rename or delete C:\Users\user\Documents\throughput.m
Undefined function or variable F
Error in example (line 48)
G(j,k)=(F(j,k)*Lshadow(j))/dist2(j).^Lexp(j);
Ubaid Ullah you are correct, that code does not define F or initialize F, or document what the purpose of F is. The author of the code has not posted anything for about 6 months, so I do not know if they will return to clarify it.

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by