Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hackassin
GitHub Repository: hackassin/Coursera-Machine-Learning
Path: blob/master/Week 2/Programming Assignment-1/plotData.m
626 views
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 and gives the figure axes labels of
4
% population and profit.
5
6
figure; % open a new figure window
7
8
% ====================== YOUR CODE HERE ======================
9
% Instructions: Plot the training data into a figure using the
10
% "figure" and "plot" commands. Set the axes labels using
11
% the "xlabel" and "ylabel" commands. Assume the
12
% population and revenue data have been passed in
13
% as the x and y arguments of this function.
14
%
15
% Hint: You can use the 'rx' option with plot to have the markers
16
% appear as red crosses. Furthermore, you can make the
17
% markers larger by using plot(..., 'rx', 'MarkerSize', 10);
18
19
%data = load('ex1data1.txt'); % read comma separated data
20
%X = data(:, 1); y = data(:, 2);
21
%m = length(y); %training_examples
22
figure(1);
23
plot(x, y, 'rx', 'MarkerSize', 10); % Plot the data, rx = red marker
24
ylabel('Profit in $10,000s'); % Set the y-axis label
25
xlabel('Population of City in 10,000s');
26
27
% ============================================================
28
29
end
30
31