Example 3 plot the data in an informative way type

This preview shows page 3 - 5 out of 5 pages.

EXAMPLE 3: Plot the data in an informative wayType the following in the lesson 1 script, save, and run:figure plot(count) title('Traffic at 3 San Antonio intersections') xlabel('Hour of day (24 hour format)') ylabel('Number of vehicles') legend('Durango','DeZavala', 'LP410'You should see a Figure Window with a labeled plot of the traffic:QuestionsAnswers)
3/2/2020GETTING STARTED QUESTIONS: Getting started4/5QuestionsAnswersWhat is xlabelThe xlabelidentifier names a MATLAB function that sets the x-axis label on the currentaxis. Similarly, the ylabelfunction sets the y-axis label on the current axis, and thetitlefunction sets a title over the current axis.Why call a function such asxlabelrather than editing the x-axis directly using the plot tools?Calling xlabel, ylabel, and titledocuments the purpose of the graph in your scriptas well as labeling the graph. If you need to make a change on the graph, you simplychange the script and rerun rather than recreating a new plot manually.What is a legend??
What does the word legendrepresent in MATLAB?identify the plot objects in the annotation.
Why is 'DeZavala'enclosed inquotes?When should I use a legend?If your axes have more than one graph, you should always use a legend. By calling thelegendfunction rather than waiting to edit the plot later, you will provide documentationfor your graph in your script.
EXAMPLE 4: Reorganize your lesson1Scriptfile into cellsQuestionsAnswersWhat is cell mode?
What is a cell?A cell is a group of statements in a MATLAB script that starts with "%% " and ends withthe start of the next cell. You can execute the statements within a cell as a unit,separately from the rest of the script.Why is cell mode useful?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture