From 5d7c7cfb79a13897bff79d9a9f7ceb058921c0e8 Mon Sep 17 00:00:00 2001 From: JACK_1729 Date: Tue, 8 Aug 2017 12:36:22 +0530 Subject: [PATCH 1/2] Update plotData.m 'x' is changed to 'X' --- mlclass-ex1/plotData.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlclass-ex1/plotData.m b/mlclass-ex1/plotData.m index d1a3f76..b720516 100644 --- a/mlclass-ex1/plotData.m +++ b/mlclass-ex1/plotData.m @@ -14,7 +14,7 @@ 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 +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 From 482f464c0fc036de506214f3452f88317904f068 Mon Sep 17 00:00:00 2001 From: JACK_1729 Date: Tue, 8 Aug 2017 12:49:43 +0530 Subject: [PATCH 2/2] Update plotData.m read data and change 'x' to 'X' --- mlclass-ex1/plotData.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mlclass-ex1/plotData.m b/mlclass-ex1/plotData.m index b720516..cb6212b 100644 --- a/mlclass-ex1/plotData.m +++ b/mlclass-ex1/plotData.m @@ -14,6 +14,10 @@ function plotData(x, y) % appear as red crosses. Furthermore, you can make the % markers larger by using plot(..., 'rx', 'MarkerSize', 10); +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