lecture 4: data visualization b burlingame 23 sept 2015
TRANSCRIPT
Lecture 4: Data Visualization
B Burlingame
23 Sept 2015
Announcements
Homework 2 due next week Lab 3 due in Lab Still no canvas access
The Plan for Today
Data visualization for engineering applications Charting and data presentation Example: LVDT calibration Adding a trend line to data Spark lines Using spreadsheet data with MatLab
Graphical Presentation in Engineering
Presenting data in graphical form is extremely important! A picture really is worth a thousand words!
Especially for engineering!
Excel & Matlab offer very powerful, easy to use graphical presentation tools.
Prose vs. a Figure
Tube wall and reflector pin temperatures vs. time during the radiative heating
feasibility test.The focus of the concentrator was brought into axial alignment with the tube bore at about t=1.4 s and re-adjusted at about t=5 s. The radiant flux impinging on the bore of the tube was estimated to be about 1.65 MW/m^2 from measurements made after the test. The tube wall temperature rises rapidly to about 275 ºC in comparison to the reflector pin, confirming predictions that non-contact heating using a radiant source and an internal conical reflector is indeed feasible.
Which would you rather look at?
Or
LVDT Sensor Linear Variable
Differential Transformer non-contact, friction-free
position sensor infinite resolution absolute position
measurement robust
Need to calibrate Measure output voltage
as the core is moved known amounts
Plot voltage vs. displacement
http://www.transtekinc.com/assets/images/240ACTION.gif
http://www.macrosensors.com/images/tutorial_page_images/images/fig1.jpg
http://www.rdpe.com/us/hiw-lvdt.htm
LVDT application – Road Simulator
http://www.swenox.com/gtc/images/4-axis-durability-rig.jpg
Calibration of LVDT Sensor
Method used by Leroy-Crandall Geotechnical Laboratory
http://gees.usc.edu/soilab/Photos/Calibration%20Pictures/mvc-159f.jpg
http://gees.usc.edu/soilab/Calibration.htm
Micrometer head
LVDT core
LVDT body
core motion
Formatting Your Chart Default is probably not the best! Publication or presentation?
Publication No fill of chart background No fill of data point markers B&W markers, lines, annotation Use line types that can be differentiated in a B&W photocopy Maximize chart area For landscape orientation, title goes closest to the spine
Annotate well Descriptive title Labeled axes with units!! Error bars with measured data
Creating a Figure
Maximize the information transfer What will the busy (or lazy) reader actually
read of your report? Structure of figure annotation:
Figure number Figure title Figure caption
Really important and often overlooked!
Figure number must be
referred to in the report
Figure title Descriptive
Figure caption The key
information you want the reader to understand from the figure
Note inset figure and additional annotation for clarity
Figure Example
(Furman, 1991)
Tube wall and reflector pin temperatures vs. time during the radiative heating feasibility test
XY Scatter vs. Line Chart
What is the difference? Different treatment of the x-axis data
XY Scatter Chart: for x data that varies continuously Interpolating between points makes sense Ex. temperature vs. time over 24 hrs
Line Chart: for x data that is categorical or equally spaced Interpolating between points may not make sense Ex. average lab report score for Tues, Wed, Thurs sections
XY Scatter Charto x-axis data varies continuouslyo Actual x-axis data that is unequally
spaced will be plotted properlyo good for analyzing trend in datao most often used for engineering
analysis
Line Charto x-axis data will be equally spaced on
the chart (beware!). If the actual x data is not equally spaced, the plot will be misleading.
XY Scatter vs. Line Chart, cont.
Smoothed line or not? Generally, not
Smoothed line can be misleading unless generating function is a good representation of actual behavior of the data
Better to leave as points or fit a regression line/curve that is a likely candidate to describe the underlying behavior
right-click | Format Data Series | smoothed line check-box
Adding Data Series
Cases where you might have additional data to add to a chart Calculations on a data set Multiple data sets
Right-click in the plot region ‘Select Data’ (2007) or ‘Source data’ (2003) Add a data series
Name X values Y values If x values are the same as previous, can just cut-and-paste
Example: LVDT_dataset_for_lecture.txt
Plotting in MatLab
There are many plot types in MatLab as well
X-Y in Excel == plot() Basic: plot(x,y) General: plot(x1,y1,…,xn,yn)
Formatting: xlabel, ylabel, title, legend
Calculating Linear Approximation Use polyfit to find the slope and intercept
Recall slope-intercept form of a linear equation y = mx + b (m = slope, b = x-intercept)
polyfit(x,y,1) The first value is the slope, the second the
intercept Given: A = polyfit(x, y, 1) linearY = x .* A(1) + A(2) plot(x, linearY)
Plots the linear approximation
Adding a Secondary Y-axis
Sometimes it is useful to plot multiple data sets on the same graph that have the same x-values, but vastly different y-values.
Plotting with multiple axis in MatLab
Basic: plotyy(x1,y1,x2,y2) – Must share the same X scale
General: line & label Complicated. The tutorial is here: http://
www.mathworks.com/help/matlab/creating_plots/using-multiple-x-and-y-axes.html
Sparklines
A small, high resolution graphics embedded in a context of words, numbers, images – Edward Tufte [2004]
Ex: 1979 saw a general upward trend in the price of gasoline . There are some commentators who believe spiraling energy costs directly lead to Jimmy Carter’s loss in the 1980 election.
Numerical Integration
Trapezoidal integration Ex. area under a
curve
Area Under ( 3+2cos(px/10) )
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
)10
cos(23 xyp
Numerical Integration, cont. Divide into trapezoids Calculate the area of the
trapezoids
Sum areas Voila! Results
Exact 21.3661977
Numerical 21.3137515
)(2 1
1ii
iii xx
yyA
Numerical Integration (recap)
Can think of integration as finding the area under a curve Break area
up into trapezoids
http://people.oregonstate.edu/~haggertr/487/integrate.htm
Numerical Integration Example
http://www.onid.orst.edu/~haggertr/487/integrate.xls
Numerical Intergration – Matlab Built in command
trapz(X, Y) X == the horizontal spacing Y == vertical magnitudes at each X
Example – Integral of Sine from 0 - π X = 0:pi/100:pi;
recall, returns 100 values from 0 to pi Y = sin(X); Q = trapz(X, Y);
Q will now hold 2, the integral of sine from 0 to pi
Numerical Differentiation
(Larsen, 2009)
First derivatives
Numerical Differentiation, cont.
Second derivatives
(Larsen, 2009)
References Furman, B. (June, 1991). A new, thermally controlled,
non-contact rotor balancing method (Doctoral dissertation). Available from University Microfilms International (UMI No. 9205634). p. 227
Larsen, R. W. (2009). Engineering with Excel, Pearson Prentice Hall, New Jersey. ISBN 0-13-601775-4
Engineering with Excel companion website: http://www.chbe.montana.edu/excel/EngExcel3.htm. Visited 25OCT2009.
Edward Tufte forum: Sparkline theory and practice Edward Tufte. Website: http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001OR.