Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 30 lines (19 sloc) 0.858 kB
c85fd8a @muehlburger initial commit
authored
1 function plotData(X, y)
2 %PLOTDATA Plots the data points X and y into a new figure
3 % PLOTDATA(x,y) plots the data points with + for the positive examples
4 % and o for the negative examples. X is assumed to be a Mx2 matrix.
5
6 % Create New Figure
7 figure; hold on;
8
9 % ====================== YOUR CODE HERE ======================
10 % Instructions: Plot the positive and negative examples on a
11 % 2D plot, using the option 'k+' for the positive
12 % examples and 'ko' for the negative examples.
13 %
14
15
16 % Find Indices of Positive and Negative Examples
17 pos = find(y==1); neg = find(y == 0);
18
19 % Plot Examples
20 plot(X(pos, 1), X(pos, 2), 'k+','LineWidth', 2, 'MarkerSize', 7);
21 plot(X(neg, 1), X(neg, 2), 'ko', 'MarkerFaceColor', 'y', 'MarkerSize', 7);
22
23 % =========================================================================
24
25
26
27 hold off;
28
29 end
Something went wrong with that request. Please try again.