could anyone help me to solve the issue
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
jaah navi
am 28 Feb. 2019
Bearbeitet: Walter Roberson
am 1 Mär. 2019
Input of the code are as given below:
N_UE=[6]%no of users
PPP =[ -0.0457 0.0814;
-0.1931 2.3985;
1.8712 1.2803;
-0.4831 1.0973;
1.5610 2.4849;
1.2560 1.2499]%x-coordinate and y-coordinate with respect to 6 users.
a=1
c =[1;
3;
2;
4;
1;
2]
centroids=4
cluster_colors = Columns 1 through 12
'm' 'g' 'y' 'b' 'r' 'c' 'k' '[.5 .6 .7]' '[.2 .3 .4]' '[.1 .2 .3]' '[.7 .8 .9]' '[.6 .4 .3]'
Columns 13 through 17
'[.4 .5 .6]' '[.7 .8 .9]' '[0.5 0 0]' '[0 0.5 0]' '[0 0 0.5]'
A =[3;
1;
1;
0;
3;
0]
with respect to the input I run the following code and got the graph.
code:
figure
plot(PPP(:,1),PPP(:,2),'k*')
hold on
for cc=1:centroids
plot(PPP(c(:,a)==cc,1),PPP(c(:,a)==cc,2),'o','color',cluster_colors{cc});
end
figure
plot(1:N_UE,A,'-*')
The first 1.jpg is correct
with respect to the 2.jpg the location of N_UE is correct.But all appears in same color
But it should have the different number of color as shown in 1.jpg.
Could anyone please help me on this.
1 Kommentar
Jan
am 28 Feb. 2019
I've formatted your code today to make it readable. Please do this by your own in following questions. Thanks.
Akzeptierte Antwort
Jan
am 28 Feb. 2019
'[.4 .5 .6]' is not a valid color definition. Define it as numerical vector - without quotes:
cluster_colors = {'m', 'g', 'y', 'b, 'r', 'c', 'k', [.5 .6 .7]}
3 Kommentare
Jan
am 28 Feb. 2019
I do not see, how you have created the two image files. Do you mean the one created by plot(1:N_UE,A,'-*')? Which colors do you expect for the line? Which star should have which color? I assume, you can simply use the loop as in the otehr case also.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!