Lab 5

Finding FWHM of a pulse

Pulses appear very often in many fields, expecially in biology, physics, data processing, etc.

They often have a bell-like shape, a bump: the curve increases, reaches a peak, then decreases towards some value.

G(x) = A exp( −(x−μ)

The parameter w regulates the "width", how spread out the curve is.

Plot some examples e.g. with A=1 , μ=1 , w=2 and w=3 , on same plot (easy to do in gnuplot).

Clearly, A is the amplitude, and curve is symmetric about x=μ, but w cannot be seen on the plot (w/√2 = σ=std deviation).

For such shapes, there are various ways of characterizing how "wide" the pulse shape is.

One convenient, and commonly used way, is to determine the

If we know a formula for the curve y = F(x), (as for a Gaussian y=G(x) above), then can find it exactly,

by intersecting y=F(x) with the horizontal line y=A/2, "at half maximum" (half amplitude).

1. Find (the formula for) FWHM of a Gaussian y=G(x) in terms of the parameters A, μ, w.

The amplitude of y=G(x) is A, so need to solve for x the equation G(x) = A/2 .

But in general, only data values would be available, no formula, so finding FWHM would need to be done numerically.

Think how FWHM can be found if we know

(by reading the values from a data file, as in Lab4),

i.e. from the pairs

2. Here is a strategy, write an algorithm for it, ON PAPER

• Need to find the maximum value

• Set the cutoff level at half maximum:

• Find the first

• Then find the first

• Then

3. Now implement the above algorithm as a

which takes the arrays x , y and returns FWHM (of the curve passing through the points).

4. Copy your Lab4.m file to

a. It reads the data file "prof300s.dat" and extracts arrays

b. Instead of plotting (comment it out), it calls the

For convenience, insert the "fwhm" function at the bottom of Lab5.m

and should show the value of FWHM it found at the end.

Submit Lab5.pdf on Canvas.