How to plot 2D location vs corresponding data in MATLAB

16 views (last 30 days)
Shwet Kashyap
Shwet Kashyap on 14 May 2022
Commented: Walter Roberson on 31 May 2022
Hi,
I have location of users in terms of lattitude and longitude, each user have a particular demand value. I have to create clusters using the position of users, and demand. Can anyone help me in designing it as there are three variables.
One another part of the problem is to how to plot it in such a way that lattitude comes in x axis, longitude in y axis, and user demand corresponding to them
It is like this
User Lattitude Longitude Demand
1 38.8643 9.2866 13
and so on
Please help me out.
  9 Comments
Walter Roberson
Walter Roberson on 18 May 2022
(Context appears to be fixed-beam signals for geostationary communication satellites.)

Sign in to comment.

Answers (3)

KSSV
KSSV on 18 May 2022
Edited: KSSV on 18 May 2022
REad abour kmeans
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/999455/MATLAB.xlsx')
T = 6689×3 table
Lattitude Longitude Demand _________ _________ ______ 38.864 -9.2866 13 39.073 -9.1616 13 38.606 -9.0866 13 38.614 -8.9283 13 39.089 -8.8949 13 38.848 -8.8116 13 37.706 -8.7699 13 37.622 -8.7116 13 38.614 -8.6949 13 39.006 -8.6449 13 37.347 -8.6282 13 38.731 -8.5782 13 38.864 -8.5449 13 39.048 -8.5282 13 38.214 -8.4866 13 38.439 -8.4282 13
x = T.(1) ;
y = T.(2) ;
d = T.(3) ;
idx = kmeans([x y d],71) ;
Warning: Ignoring rows of X with missing data.
scatter3(x,y,d,[],idx,'filled')
colorbar
cmap = turbo(71) ;
colormap(cmap)
view(2)
  5 Comments
Shwet Kashyap
Shwet Kashyap on 22 May 2022
idx = T.Demand == 13 ;
T(idx,:)
This command provide data from the original table T, I require data from the clustered table.

Sign in to comment.


Walter Roberson
Walter Roberson on 18 May 2022
You can create a triangulation object and then use trimesh() to plot the data.
Or you can create a scatteredInterpolant() object and interpolate over a grid of coordinates and then imagesc() or pcolor() to create a map.
  7 Comments
Walter Roberson
Walter Roberson on 24 May 2022
kmeans and dbscan are completely incompetent at making the distribution fair. I believe some of the other algorithms you mentioned are as well.

Sign in to comment.


Shwet Kashyap
Shwet Kashyap on 25 May 2022
Hey, it may be they are not able to make a fair distribution which is a subject of research, but one should be able to make clusters using the data given. If we ignore Demand, there must be a way out to create clusters using the lattitude, and longitude. Whereas the kmeans is providing some improvement from the original data, as in in orifginal data some clusters were having zero demand but after k-means clustering all clusters have some demand. The dbscan is a matter of research. Can this data be processed using support vector machine method
regards,
  11 Comments
Walter Roberson
Walter Roberson on 31 May 2022
The entire point of kmeans is to group points that are close together, and separate the groups (clusters). If you have a demand of 555 at one location and a distance to a demand of 13 and you ask for two clusters, then it is going to put one at the 13 and the other at the 555, and will not try to split the load.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!