Math 171 - Alexiades
                  HW , to be done ON PAPER (and turn in on Tue)
                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.
  • A prime example is a "bell-curve", or "Gaussian", like:
            G(x) = A exp( −(x−μ)2 / w2 ) ,   for some parameters A, μ, w.
      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 Full Width at Half Maximum (FWHM).
    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 only N points of a quantity y = F(x),
    (by reading the values from a data file, as in Lab4),
    i.e. from the pairs (xi , yi), i=1:N, which are stored in two arrays x and y.

    2. Here is a strategy, write an algorithm for it, ON PAPER (will be done on Matlab in the next lab).
      • Need to find the maximum value M (height of the peak), and the index where it occurs, call it ipeak ,
      • Set the cutoff level at half maximum:  cut = M/2.
      • Find the first xi (before ipeak, on the way up) at which yi ≥ cut. Call it xLeft.
      • Then find the first xi (after ipeak, on the way down) at which yi ≤ cut. Call it xRight.
      • Then FWHM = xRight − xLeft .