Graph plot of users and subcarriers with respect to throughput
Show older comments
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)
Walter Roberson
on 5 Dec 2017
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
Prabha Kumaresan
on 5 Dec 2017
Edited: Walter Roberson
on 5 Dec 2017
Walter Roberson
on 5 Dec 2017
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.
Categories
Find more on Create Plots on Maps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!