diff --git a/mlclass-ex1/plotData.m b/mlclass-ex1/plotData.m index d1a3f76..cb6212b 100644 --- a/mlclass-ex1/plotData.m +++ b/mlclass-ex1/plotData.m @@ -14,7 +14,11 @@ function plotData(x, y) % appear as red crosses. Furthermore, you can make the % markers larger by using plot(..., 'rx', 'MarkerSize', 10); -plot(x, y, 'rx', 'MarkerSize', 10); % Plot the data +data = load('ex1data1.txt'); % read comma separated data +X = data(:, 1); y = data(:, 2); +m = length(y); + +plot(X, y, 'rx', 'MarkerSize', 10); % Plot the data ylabel('Profit in $10,000s'); % Set the y−axis label xlabel('Population of City in 10,000s'); % Set the x−axis label