MATLAB GRAPHING

# MATLAB GRAPHING - Department of Engineering Education,...

This preview shows pages 1–2. Sign up to view the full content.

Department of Engineering Education, Virginia Polytechnic Institute and State University Page 1 of 17 Copyright J.C. Malzahn Kampe, 2004-5 EngE 1024 Fall 2005 ______________________________________________ MATLAB GRAPHING Using MATLAB 7.0 We often plot data in a variety of ways in order to see if a common type of graphing scheme will cause the data points to fall in a fairly straight line (as opposed to a curve). When this occurs, we can determine the form of an empirical function that describes the data. We fit data that can be represented by a straight line on a rectilinear plot to a linear function of the y = mx + b form. Data that produce a straight line on a log-log plot we fit to a power function of the y = b x m form. Data that line up on a semilog plot (y-axis logarithmic) we fit to an exponential function of the form y = b e mx . Our usual procedure is to plot the data points on all three types of grids (rectilinear, fully logarithmic, and semi-logarithmic,) to determine which of the three grids lines up the data points best. Once we know the type of grid that produces the best line-up of data points, the next order of business is to determine the constants m and b for the equation of the line that represents the data. Then we use our appropriate m and b values to generate the “line of best fit” and plot it on the best grid along with the data points. This document outlines the basic steps used in MATLAB to produce a plot, to determine the equation constants, and to generate the best-fit line. The general procedure is given below and then illustrated with a guide for the three types of functions (linear, power, and exponential) mentioned above. This might seem somewhat repetitive, but it gives an orderly account of the syntax and output interpretation you will need to use MATLAB’s polyfit command for these functions. General MATLAB Graphing Procedure Steps 1. Enter the experimental data. 2. Plot the data as points on the three different grids (rectilinear, log-log, and semi-log). 3. Choose the grid that best lines up the data and use only that plot for the rest of the steps. 4. Determine the equation constants (m and b) of the best-fit line using a polyfit command. 5. Calculate new y-values using the determined values of m and b from Step 4. 6. Put the best-fit line on the graph by plotting the calculated y-values versus the experimental x-values. 7. Put the figure in proper graphing format using Steps 8 through 12. 8. Adjust axes limits so data points do not reside on the perimeter of the grid. 9. Insert the grid lines, if desired. 10. Label each axis with the plotted quantity name, variable symbol, and units Example axis label: Area A, m 2 11. Add the figure title and move it to a position below the plot. 12.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/21/2008 for the course ENGE 1024 taught by Professor Dcohanehi during the Fall '06 term at Virginia Tech.

### Page1 / 17

MATLAB GRAPHING - Department of Engineering Education,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online