plotData.m 981 B

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