Graph plot of users and subcarriers with respect to throughput

N_UE=[ 10 20 30 40 50];
N_SC=[ 60 70 80 90 100];
throughput=rand(50,100);
for t=1:length(N_UE);
for r=1:length(N_SC);
e = throughput(t:r);
plot e;
hold on
end
end
how to plot the figure for the code as i am unable to get it.

Answers (1)

plot e;
means the same thing as
plot('e');
Perhaps you want
plot(e);
But I suspect that what you want is
N_UE=[ 10 20 30 40 50];
N_SC=[ 60 70 80 90 100];
num_UE = length(N_UE);
num_SC = length(N_SC);
throughput = rand(num_UE, num_SC);
surf(N_UE, N_SC, throughput, 'edgecolor', 'none);

2 Comments

thanks for your response.
but i want to have in 2D plot
N_UE=[10 20 30 40 50] means it needs to take 1:10,1:20,1:30,1:40 and 1:50; similarly N_SC=[60 70 80 90 100] means it needs to take 1:60,1:70,1:80,1:90,1:100;
so how to plot the graph of 1:10 users versus 1:60 with respect to throughput in 2D.
Your requirements are hard to understand
N_UE_bounds = [10 20 30 40 50];
N_SC_bounds = [60 70 80 90 100];
num_UE = length(N_UE_bounds);
num_SC = length(N_SC_bounds);
for Uidx = 1 : num_UE
N_UE_max = N_UE_bounds(Uidx);
for Sidx = 1 : num_SC
N_SE_max = N_SE_bounds(Sidx);
for t = 1 : N_UE_max
for r = 1 : N_SE_max
throughput = rand(t, r);
e = throughput(t:r); %will often be empty...
plot(e);
hold on;
end
end
end
end
I do not understand why you bother to construct an entire random matrix and then only take linear indexes t:r out of the random matrix, especially as it would be common for t to be less than r, leading to empty data being extracted. I used t:r here because that was your requirement from https://www.mathworks.com/matlabcentral/answers/371097-plotting-the-graph-of-x-and-y-with-respect-to-z#comment_512718
You are certainly making a lot of plot calls, and the output is not going to make any sense at all.

Sign in to comment.

Tags

Asked:

on 5 Dec 2017

Commented:

on 5 Dec 2017

Community Treasure Hunt

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

Start Hunting!