view plotData.m @ 6:141d81a2acf5 default tip

Remove usage of sum function in cost function (thanks Jeroen Willems)
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Tue, 08 Nov 2011 03:30:56 -0500
parents a4c4da8f4ac0
children
line wrap: on
line source

function plotData(X, y)
  ##PLOTDATA Plots the data points X and y into a new figure 
  ##   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.

  ## Create New Figure
  figure; hold on;

  ## Find Indices of Positive and Negative Examples
  pos = find(y==1); neg = find(y == 0);
  ## Plot Examples
  plot (X(pos, 1), X(pos, 2), "k+","LineWidth", 2, 
        "MarkerSize", 7);
  plot (X(neg, 1), X(neg, 2), "ko", "MarkerFaceColor", 
        "y", "MarkerSize", 7);

  hold off;

endfunction