Request for matlab code regarding divsion of sub grids in a scatter plot
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have designed a scatter plot by using below code:
clear all, close all, clc;
xm =100;
ym = 100;
sink.x =0.5*xm;
sink.y =0.5*ym;
n =200;
p = 0.05;
m = 0.1;
rmax = 10;
figure;
for i = 1:1:n
S(i).xd = rand(1,1)*xm;
XR(i)= S(i).xd;
S(i).yd = rand(1,1)*ym;
YR(i)= S(i).yd;
S(i).G = 0;
S(i).type = 'N';
temp_rnd0 = i;
if(temp_rnd0>=m*n+1)
plot(S(i).xd, S(i).yd,'o');
hold on;
end
end
S(n+1).xd = sink.x;
S(n+1).yd = sink.y;
plot(S(n+1).xd,S(n+1).yd,'x');
for r = 0:1:rmax;
if(mod(r, round(1/p)) == 0)
for i= 1:1:n
S(i).G = 0;
S(i).cl = 0;
end
end
cluster = 1;
for i =1:1:n
temp_rand = rand;
if ((S(i).G)<=0)
if(temp_rand<= (p/(1-p*mod(r,round(1/p)))))
S(i).type = 'C';
S(i).G = round(1/p)-1;
C(cluster).xd = S(i).xd;
C(cluster).yd = S(i).yd;
plot(S(i).xd,S(i).yd,'k*');
end
end
end
end
NrGrid = 2; % Number Of Grids
x = linspace(0, 100, NrGrid+1);
[X,Y] = meshgrid(x);
figure(1)
plot(X,Y)
hold on
plot(Y,X)
hold off
I have divided that scatter plot into 4 zones using 'NrGrid'. Now depending on density of points in each zone i have to divide it into subgrids i.e; if density is high then divide it to 4 zones, if density is medium divide it to 2 zones and if density is less no division. So, Can anyone please help me in implementing code for division of this grid into subgrids?? I have attached my output to the code till now below.
![jyo.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/249371/image.png)
2 Kommentare
KALYAN ACHARJYA
am 21 Nov. 2019
Bearbeitet: KALYAN ACHARJYA
am 21 Nov. 2019
How to get the density? Is there any specific marker or all?
Is there any specific value of range, whether it may be high or medium?
Antworten (0)
Siehe auch
Kategorien
Mehr zu Scatter 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!