plotData.m 1.0 KB

12345678910111213141516171819202122232425262728
  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. figure; % open a new figure window
  6. plot(x, y, 'rx', 'MarkerSize', 10); % Plot the data
  7. ylabel('Profit in $10,000s'); % Set the y􀀀axis label
  8. xlabel('Population of City in 10,000s'); % Set the x􀀀axis label
  9. % ====================== YOUR CODE HERE ======================
  10. % Instructions: Plot the training data into a figure using the
  11. % "figure" and "plot" commands. Set the axes labels using
  12. % the "xlabel" and "ylabel" commands. Assume the
  13. % population and revenue data have been passed in
  14. % as the x and y arguments of this function.
  15. %
  16. % Hint: You can use the 'rx' option with plot to have the markers
  17. % appear as red crosses. Furthermore, you can make the
  18. % markers larger by using plot(..., 'rx', 'MarkerSize', 10);
  19. % ============================================================
  20. end