MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.1 Simple Plot of Time Versus Distance Created in MATLAB ®.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.2 Adding a grid, a title, and labels makes a plot easier to interpret.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.3 The graphics window opens on the top of the command window. You can resize it to a convenient shape, or dock it with the MATLAB ® desktop.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Table 5.1 Basic Plotting Functions
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.4 The hold on command can be used to layer plots onto the same figure.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.5 Multiple plots on the same graph.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.6 The peaks function, plotted with a single argument in the plot command.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.7a Complex numbers are plotted with the real component on the x-axis and the imaginary component on the y-axis when a single array is used as input.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.7b When two complex arrays are used in the plot function, the imaginary components are ignored.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Table 5.2 Line, Mark, and Color Options
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.8a Adjusting the line, mark, and color style.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.8b Multiple plots with varying line styles and point styles.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Table 5.3 Axis Scaling and Annotating Plots
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.9 Final version of the sample graph, annotated with a legend, a text box, a title, x and y labels, and a modified axis.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.10 A sketch of the predicted equation behavior.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.11 A plot of the Clausius–Clapeyron equation.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.12 The range is zero, if the cannon is perfectly vertical or perfectly horizontal.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.13 The predicted range of a projectile.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.14 Subplots are used to subdivide the figure window into an m × n matrix.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.15 The subplot command allows the user to create multiple graphs in the same figure window.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.16 A polar plot of the sine function.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Practice Exercises 5.3 continued on next slide
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Practice Exercises 5.3 (continued) continued on next slide
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Practice Exercises 5.3 (continued) continued on next slide
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Practice Exercises 5.3 (continued) continued on next slide
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Practice Exercises 5.3 (continued)
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Table 5.4 Rectangular and Logarithmic Plots
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.17 Linear and logarithmic plots, displayed using the subplot function.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.18 Diffusivity data plotted on different scales. The data follows a straight line when the log 10 of the diffusivity is plotted on the y-axis vs. the inverse temperature on the x-axis.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Practice Exercises 5.4 continued on next slide
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Practice Exercises 5.4 (continued) continued on next slide
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Practice Exercises 5.4 (continued) continued on next slide
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Practice Exercises 5.4 (continued) continued on next slide
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Practice Exercises 5.4 (continued) continued on next slide
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Table 5.5 Bar Graphs and Pie Charts
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.19 Sample bar graphs and pie charts. The subplot function was used to divide the window into quadrants.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.20 Histogram of grade data. a) Results from the hist function b) Results using histc to control the bin definition
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.21 Histograms and line plots are two different ways to visualize numeric information.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.22 MATLAB ® allows the y-axis to be scaled differently on the left-hand and right-hand sides of the figure. a) Both lines were drawn using the same scaling. b) The sine curve was drawn using the scaling on the left axis, while the exponential curve was drawn using the scaling on the right axis.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.23 The plotyy function can generate several types of graphs, including semilogx, semilogy, and loglog.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.24 Sketch of the predicted data behavior.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Table 5.6 Group I Elements and Selected Physical Properties
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.25 In the left-hand figure, the two sets of values were plotted using the same scale. Using two y-axes allows us to plot data with different units on the same graph, as shown in the right-hand figure.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.26 Function plots do not require the user to define arrays of ordered pairs.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Table 5.7 Three-Dimensional Plots
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.27 A three-dimensional plot of a spring. MATLAB ® uses a coordinate system consistent with the right- hand rule.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.28 Simple mesh created with a single two-dimensional matrix.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.29 Mesh and surf plots are created with three input arguments.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.30 Surface and contour plots are different ways of visualizing the same data.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.31 A variety of contour plots is available in MATLAB ®.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.32 MATLAB ® offers interactive tools, such as the insert tool, that allow the user to adjust the appearance of graphs.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.33 MATLAB ® allows you to edit plots by using commands from the toolbar.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.34 Edited plot of a sphere.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.35 Plotting from the workspace window, using the interactive plotting feature.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure P5.11a A tensile testing machine is used to measure stress and strain and to characterize the behavior of materials as they are deformed.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure P5.11b A tensile testing machine is used to measure stress and strain and to characterize the behavior of materials as they are deformed.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Table P5.11 Tensile Testing Data
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Table P5.19 Exponential Increase in Transistor Count on Integrated Circuits continued on next slide
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Table P5.19 (continued) Exponential Increase in Transistor Count on Integrated Circuits
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure P5.30 Tornado plot.