Classifiying the data points
3 ビュー (過去 30 日間)
古いコメントを表示
Mehmet Volkan Ozdogan
2019 年 7 月 2 日
コメント済み: Image Analyst
2019 年 7 月 4 日
Hi i have a data set such as;
[x y z d], (100x4) matrices
x,y and z are coordinates and the d is the measure of a distance.Every d is corresponding with one point (x, y, z)
I want to create 10 classes from d and colorize the points (x,y,z) according to this classes and plot it
is anyone have idea?
Thank you
0 件のコメント
採用された回答
Image Analyst
2019 年 7 月 2 日
Try kmeans with 10 classes, and operating on the d values:
data = rand(100, 4)
x = data(:, 1);
y = data(:, 2)
z = data(:, 3);
d = data(:, 4);
numClasses = 10
% Find classes based on 4th column.
indexes = kmeans(d, numClasses);
% Make up a colormap with 10 colors
cmap = jet(10);
% Assign a color to each data point based on it's class
markerColors = zeros(10, 3); % 10 colors.
for k = 1 : size(data, 1)
thisClassNumber = indexes(k)
markerColors(k, :) = cmap(thisClassNumber, :);
end
scatter3(x, y, z, 50, markerColors, 'filled');
fontSize = 20;
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
zlabel('Z', 'FontSize', fontSize);
There is a marker at each (x,y,z) location and its color depends on which of the 10 classes that point's "d" value got classified into.
10 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Classification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!