Download Plot Model Plotting Basics - Computational Methods - Lecture Slides and more Slides Calculus for Engineers in PDF only on Docsity!
Engr/Math/Physics 25
Chp5 MATLAB
Plots & Models 1
Learning Goals
- List the Elements of a COMPLETE Plot
- e.g.; axis labels, legend, units, etc.
- Construct Complete Cartesian (XY) plots
using MATLAB
- Modify or Specify MATLAB Plot Elements: Line
Types, Data Markers, Tic Marks
- Distinguish between INTERPolation
and EXTRAPolation
Learning Goals cont
- Use Regression Analysis as quantified by
the “Least Squares” Method
- Calculate
- Sum-of-Squared Errors (SSE or J)
- The Squared Errors are Called “Residuals”
- “Best Fit” Coefficients
- Sum-of-Squares About the Mean (SSM or S)
- Coefficient of Determination (r 2 )
- Scale Data if Needed
- Creates more meaningful spacing
Learning Goals cont
- Build Math Models for Physical Data using
“nth^ ” Degree Polynomials
- Use MATLAB’s “Basic Fitting” Utility to find
Math models for Plotted Data
- Use MATLAB to Produce 3-Dimensional
Plots, including
- Surface Plots
- Contour Plots
Why Plot? cont
- Plots have TREMENDOUS Utility
in Two Major Areas
1. Communication
- To Help OTHERS understand the RESULTS of
Your Tests or Experiments or Theories
2. Analysis
- To Help You ANALYZE Data or
Theories to Determine the
Significance or Meaning of the Data
Plotting Trivia
- Rene Decartes (1596-1650)
Developed “Cartesian” (XY)
Plots in about 1637
- Florence Nightingale Developed the “Polar
Area Plot” (Pie Chart) in 1857
Gate Voltate to Balance ElectroStatic and Spring Forces vs. d
0
2
4
6
8
10
12
14
16
18
0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2. Cantilever Height, d (μm)
Gate Potential (Vdc)
file = ElectroStatics_0104.xls
Threshold
Turn-On (Zip-Up)
Turn-Off (Peel-Off)
PARAMETERS
- E = 135 Gpa (PolySi)
- L = 100 μm
- W = 60 μm
- t = 3 μm• d
- Z = 300 μmo^ = 2 μm
- V (^) Th = 17.00396 Vdc
- V (^) r = 7.903 Vdc
V (^) r (^) Arrow CallOut
Theoretical Plot → NO Data Markers
Important Output Value
MATLAB Plot Example
Launch
A Math Model for
the Height, y, vs.
the Distance, x:
y = 0. 43 1. 73 x
- Where both x & y are in units of miles
Use MATLAB to Plot
y vs x for a 51 mi
DownRange Dist
Plot OutPut
- The plot appears in the Figure window
- Output from One of
- Use the menu system. Select Print on the File menu in the Figure window. Answer OK when you are prompted to continue the printing process.
- Type print at the command line. This command sends the current plot directly to the printer. 3. Save the plot to a file to be printed later or imported into another application such as PowerPoint. You need to know something about graphics file formats to use this file properly. See the subsection Exporting Figures.
Elements of a Useful Plot
- The essential features of a Maximally
Understandable Plot
- Each axis must be labeled with the name of the quantity being plotted and its units.
- If two or more quantities having different units are plotted (such as when plotting both speed and distance versus time), then indicate the units in the axis label if there is room, or in the legend or labels for each curve
- Each axis should have regularly spaced tick marks at convenient intervals - not too sparse, but not too dense - with a spacing that is easy to interpret and interpolate.
- e.g.; use 0.1, 0.2, and so on, rather than 0.13, 0.
Elements of a Useful Plot cont
- Sometimes data symbols are connected by lines to help the viewer visualize the data, especially if there are few data points. However, connecting the data points, especially with a solid line, might be interpreted to imply knowledge of what occurs between the data points. Take appropriate care to prevent such MisInterpretation.
- If you are plotting points generated by evaluating a function (as opposed to measured data), do not use a symbol to plot the points. Instead, be sure to generate many points , and connect the points with solid lines. The Curve should be SMOOTH
grid Command
- The grid command displays gridlines at the
tick marks corresponding to the tick labels.
- Type grid on to add gridlines;
- Type grid off to stop plotting gridlines.
- When used by itself, grid toggles this feature on
or off, but you might want to use grid on and
grid off to be sure.
LineWidth Command
- MATLAB’s Default width and color for a
plotted line are
- Thin
- Blue
- This “thin blue line” is often hard to SEE and
to PHOTOCOPY
- Use 'LineWidth',n, to increase WIDTH
- Use color-spec to make BLACK
Affect of grid, axis, LineWidth
(^00 5 10 15 20 25 30 35 40 45 )
1
2
3
4
Distance (mi)
Height (mi)
Rocket Height as a Function of Downrange Distance
plot(x,y, 'k', 'LineWidth', 3), xlabel('Distance (mi)'),... ylabel('Height (mi)'),grid on, axis([0 51 0 4.1]),... title('Rocket Height as a Function of Downrange Distance')
Command Session
Compare to the Previous Version