PH15720 Data Handling - Aberystwyth University

Download Report

Transcript PH15720 Data Handling - Aberystwyth University

PH15720
Laboratory Techniques An Introduction to MATHCAD
Introduction
• Review of Last Week
• Dealing with experimental Data
Review of Last Week’s Exercise
• IF YOU DON’T UNDERSTAND – ASK!!!
• Explain your work
• Read the question
• Don’t use single character names
• Don’t redefine dimensions (m,s)
Translating Equations
• Equations in physics given in general form
• Need to translate for specific problem
Translating Equations #2
Textbook
MathCAD
F  ma
FHook   mPendulumg

Translating Equations #3
Textbook
KE   m  v
1
2
2
1
2
MathCAD KEcar   mCarvCar
2
Dealing with Experimental Data
• 5 stage process
– Get data into MathCAD
– Process data (scale, units etc)
– Plot Data
– Fit curve (line) to data
– Compare theory with experiment
Matrices, Vectors and Arrays
• Way of storing related data
– Experimental Results
– Coefficients
• Interpolation
• Polynomial
– Solutions to DEs
– 3D position/velocity/force
• Single Name – Many values
Arrays, Vectors & Matrices Terminology
• Vector – 1-dimensional
• Matrix – 2-dimensional
• Array – general term, covers both
Getting Data into MathCAD
• Put data in matrix
– 1 column per measurement
– 1 row per data point
• Use Input Table
– Insert|Data|Table
• Table re-sizes & scrolls as needed
Data Input Example
• Resistor Experiment
• Apply voltage, measure Current
Voltage Current (mA)
Reading s
0
0
1
2
3
4
5
6
1
0
1
2
3
4
0
1.23
2.45
3.7
4.92
1 row per
reading pair
Process Experimental Data #1
• Extract columns with column operator M<>
– Insert into worksheet from
• Matrix toolbar
• <ctrl>-6
– Fill in column number to extract
– Numbering starts at 0
Process Experimental Data #2
Readings
0
0
1
2
3
4
1
0
1
2
3
4
 0 
Readings
V
 1 
IMeasured Readings
mA
VApplied
0
1.23
2.45
3.7
4.92
Input table as
before
Extract Voltage
to vector & apply
units
Same for current
Check on extracted vectors
• Single column
• Converted to base units
• Scroll bars if needed
0
1
VApplied  2 V
0
1.23  10
3
IMeasured  2.45  10
3
3
3.7  10
4
4.92  10
3
3
A
Plotting data
• X-Y Plot can plot 1 vector against another,
if both vectors have same number of
elements
• Use plot formatting to change to single
points
Plotting data Example
 03
4 .9 21
0 .0 06
0 .0 04
IMeasu red
0 .0 02
0
0
0
0
1
2
VApp lied
3
4
4
Fit curve/line to data
• Only simple straight line fits for now
– slope(Vx,Vy)
– intercept(Vx,Vy)
• Details in help system
• Units carry through calculation
• Sometimes need 1/slope
Slope calculation
-Resistor Example
RMeasured
1
slope ( VApplied IMeasured)
RMeasured  812.348 
Compare theory to experiment
•
•
•
•
Create function
Plot on same graph as experimental data
Use multiple variables on x- and y- axes
Separate items on axes with commas
Compare theory to experiment
ITheory( vv)
• Function gives
theoretical current
vv
RMeasured
ITheory( 1 V)  1.231 mA
ITheory( 2 V)  2.462 10
3
• Test function at a
couple of points
A
Plot theory & data
 03
6 .1 551
Multiple
items on x& y-axes
0 .0 06
IMeasu red
ITh eory ( v v )
‘vv’ exists
only to make
the plot
0 .0 08
0 .0 04
0 .0 02
0
0
0
0
Scale x-axis to suit
1
2
3
VApp lied v v
4
5
5