Titles, Labels, and Grids Matlab

Good engineering practice requires that we include axis labels and a title in our plot. The following commands add a title, x – and y -axis labels, and a background grid:


xlabel(‘Time, sec’)

ylabel(‘Distance, ft’)

grid on


These commands generate the plot in Figure 5.2 . As with any MATLAB ®com-mands, they could also be combined onto one or two lines, separated by commas:

plot(x,y) , title(‘Laboratory Experiment 1’)

xlabel(‘Time, sec’ ), ylabel(‘Distance, ft’), grid