Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hackassin
GitHub Repository: hackassin/Coursera-Machine-Learning
Path: blob/master/Week 8/Programming Assignment - 7/ex7/plotDataPoints.m
863 views
1
function plotDataPoints(X, idx, K)
2
%PLOTDATAPOINTS plots data points in X, coloring them so that those with the same
3
%index assignments in idx have the same color
4
% PLOTDATAPOINTS(X, idx, K) plots data points in X, coloring them so that those
5
% with the same index assignments in idx have the same color
6
7
% Create palette
8
palette = hsv(K + 1);
9
colors = palette(idx, :);
10
11
% Plot the data
12
scatter(X(:,1), X(:,2), 15, colors);
13
14
end
15
16