how can i plot the graph for the following code

nb_user = 5;
sub_used = 3;
nb_sub = sub_used * nb_user;
association = zeros(nb_user,nb_sub);
throughput_thre = 0;
sub_order = [1 1 1 2 2 2 3 3 3 4 4 4 5 5 5];
for s = 1:nb_user
association(s,((s-1)*sub_used+1):(s*sub_used)) = ones(1, sub_used);
end
for s = 1:nb_user
for k = 1:nb_sub
if association (s,k) == 1
throughput(s,k) = 3*sub_order(k);
end
end
end
u =0;
for s = 1:nb_user
for k = 1:nb_sub
u = u + throughput(s,k);
end
end
association;
throughput;

답변 (1개)

KSSV
KSSV 2017년 11월 9일

0 개 추천

nb_user = 5;
sub_used = 3;
nb_sub = sub_used * nb_user;
association = zeros(nb_user,nb_sub);
throughput= zeros(nb_user,nb_sub);
throughput_thre = 0;
sub_order = [1 1 1 2 2 2 3 3 3 4 4 4 5 5 5];
for s = 1:nb_user
association(s,((s-1)*sub_used+1):(s*sub_used)) = ones(1, sub_used);
end
for s = 1:nb_user
for k = 1:nb_sub
if association (s,k) == 1
throughput(s,k) = 3*sub_order(k);
end
end
end
u =0;
for s = 1:nb_user
for k = 1:nb_sub
u = u + throughput(s,k);
end
end
x = 1:nb_user ;
y = 1:nb_sub ;
[X,Y] = meshgrid(x,y) ;
figure
surf(X,Y,association') ;
figure
surf(X,Y,throughput') ;

댓글 수: 5

with respect to the code i am getting figure and i have attached it. could you tell me the figure explanation
KSSV
KSSV 2017년 11월 11일
@Prabha....it is you who gave the code.....and asked to plot..that's the way to plot.....it is you, who have to explain......:)
yes,I want to draw the graph in two dimensional.Is it possible for the above code to be drawn in 2D graph.
KSSV
KSSV 2017년 11월 11일
That's what it does..it plots a surface....as you have two dependent parameters.
i am getting the graph in 3 dimensional view but i want to be drawn with respect to x and y axis. how can i able to convert from x,y and z axis to x and y axis.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2017년 11월 9일

댓글:

2017년 11월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by