Outline
The Matlab environment Variables Arrays Scripts and functions Plotting
Matlab Tutorial
September 25, 2007
The Matlab Environment
Path Current Directory
myVar = 42;
>
Remember.
. make sure you have the correct path!
Command Window
Com
Physics 257 Lecture 1: Error Propagation & Matlab
Prof. Matt Dobbs
Physics Department, McGill U.
TA Office Hours
The TAs are there to help you. use them! Lab TAs
You may see these TAs during their office hours and ask questions about the lab and lab
Dr. Dobbs' Howto: Create a scatter plot in Matlab
This howto document walks you through the creation of an x-y scatter plot, and drawing a line through it in Matlab. 1. Open matlab. Start All Programs Matlab Matlab. 2. Let's create some a vector of x
Physics 257: Experimental Methods I Syllabus Course Description Experimental Methods I. (Co-requisite: PHYS230 or PHYS251!). Introductory laboratory work and data analysis with a focus on experiments in mechanics, optics and thermodynamics. Introduction t
Bar Length Measurements
25
Mean = 152.1 mm
Number of measurements
Measurements from first lecture
20
Std. dev = 0.34 mm
15
10
5
0 151
151.2
151.4
151.6
151.8
152
152.2
152.4
152.6
152.8
153
Length of bar (mm)
Significant Figures
How to report on the resu
Important Probability Distributions in Physics
Binomial Distribution
Generally applies to experiments in which the result can be one of only a small number of possible outcomes/final states
Permutations and Combinations
How many different ways are there
Instrumental vs. Statistical Uncertainties
Instrumental uncertainties
Fluctuations in the reading of a measurement instrument to determine
Length, mass, voltage, current etc.
Statistical Fluctuations/Uncertainties/Errors
We noted in the previous lectur
Understanding Chi-Squared
2 =
reduced 2 =
yi f ( xi ; ai ) i i =1
N
2
2
DOF
=
1 N M
i =1
N
yi f ( xi ; ai ) i
2
Performing a Least-Squares Fit and Understanding the Result
A complete example
Consider 2 situations:
Comparing sampled Data directly wi
CHAPTER
where
till'
index k runs lrou: I lOllI,
III
luct.
Wl'
cun gcncrulizc the method even fur-
7
LEAST-SQUARES FIT TOA POLYNOMIAL
ther by writing I':qualillil (7,2) as
f I'
y(x)
=
2: akfi:(x)
k=l
/1/
(7.3)
where the functions fk(X) could be the powers
Admin Items
Lecture 6: Nonlinear Curve Fitting
Oct. 28 Last regular lecture. Assignment 7 will Oct. regular be posted. No lecture on Nov. 4, but the final assignment will No be posted (Assignment 8)! November 11 Review and Research lecture. November Nov 1
Physics 257 Lecture 0: Basic Statistics & Introduction to Matlab
Prof. Matt Dobbs
Physics Department, McGill U.
Outline
Orientation session was yesterday, Sept 6. If you missed it, download the information from WebCT. We covered:
Syllabus, lab rules
Opinion Polls
Physics 257 Lecture 5: More fun with Matlab
Prof. Matt Dobbs
Physics Department, McGill U.
Question from a student- how do we interpret:
The poll surveyed 1,002 Quebecers from Oct. 10 to Oct. 22. It is considered accurate to within 4.
Outline
Physics 257 Lecture 4: 2
Prof. Matt Dobbs
Physics Department, McGill U.
Questions ? Comments from Assignment and Lab reports.
Be careful not to round off numbers in intermediate calculations!
Review of 2 and DoF The Language of Probability
Physics 257 Experimental Methods Orientation Session
Introductory laboratory work and data analysis as related to mechanics, optics and thermodynamics. Introduction to computers as they are employed for laboratory work, for data analysis and for nume
Admin Items
Physics 257 Lecture 8: Review (selected topics only)
Prof. Matt Dobbs
Physics Department, McGill U.
Grades for all assignments and labs will be available within a week on WebCT. Online Mercury course evaluations are available
"you may a
Math 222 Assignment 3
dt 1. Recall that sin-1 x = 0x 1-t2 . Use the binomial theorem and this integral to find the Maclaurin expansion of sin-1 x.
2. Find a unit vector perpendicular to both v = -3i + j + 2k and -i + 2j + 3k. 3. Show that the points
Mathematics 222 Assignment 1
1 1. Does the sequence bn = sin( + n ) converge or diverge? If it converges, 2 what is the limit?
2. Does the sequence bn = n cos(n) converge or diverge? If it converges, find the limit.
1 3. Does the sequence bn = n2 (
Dr. Dobbs' Howto: Interface Matlab to Excel
(so you can format pretty looking tables for your lab reports)
Matlab is an ideal tool for making great looking plots, charts, and graphs easily. It is not well suited to making nicely formatted tables. Sin
Summary from last week
Physics 257 Lecture 8: Fourier Transform
Prof. Matt Dobbs
Physics Department, McGill U.
Numerical minimizations of
=
2 i
( yi - f ( xi ; ai ) )2
yi
2
yields the best fit parameters for the function f.
In Matlab, this can
Admin Items
Physics 257 Lecture 6: Curve Fitting
Prof. Matt Dobbs
Physics Department, McGill U.
November 8 Last "regular" lecture. November 15 Last lecture (democratic)
We will do 2/3 of the following:
Review and open floor for questions. Fun-stuf
Physics 257 Lecture 2: Probability ( & yet more matlab )
Prof. Matt Dobbs
Physics Department, McGill U.
Important Topics from Last Lecture
Covariance (from last week)
s xy =
( x - x )( y
i i
i
- y)
N -1
rxy =
s xy sx s y
error propagation wi
Gaussian Distribution
Physics 257 Lecture 3: Least Squares Fit
Prof. Matt Dobbs
Physics Department, McGill U.
Question from last class: where does the Gauss distribution come from? Used in the 1730s by de Moivre as the limiting case for large N bin
Time-varying signals
Physics 257 Lecture 7: Basic Time-Series Analysis: Introduction to the Fourier Transform
Prof. M. Dobbs, Physics 257 Nov 6. 2008
2
Time-varying signals
Time Domain Waveform
A time domain waveform is just the magnitude of some time con