1
0
Fork 0

Plot the data

master
neingeist 10 years ago
parent 580e52ddc5
commit d52fa95328

@ -1,5 +1,5 @@
function plotData(X, y) function plotData(X, y)
%PLOTDATA Plots the data points X and y into a new figure %PLOTDATA Plots the data points X and y into a new figure
% PLOTDATA(x,y) plots the data points with + for the positive examples % PLOTDATA(x,y) plots the data points with + for the positive examples
% and o for the negative examples. X is assumed to be a Mx2 matrix. % and o for the negative examples. X is assumed to be a Mx2 matrix.
@ -11,7 +11,11 @@ figure; hold on;
% 2D plot, using the option 'k+' for the positive % 2D plot, using the option 'k+' for the positive
% examples and 'ko' for the negative examples. % examples and 'ko' for the negative examples.
% %
pos = find(y==1);
neg = find(y==0);
plot(X(pos, 1), X(pos, 2), 'k+');
plot(X(neg, 1), X(neg, 2), 'ko');