1. Use the Matlab load or File > Import data
command to get your data into the Matlab workspace
vector, a pair of vectors (x and y), or a matrix with the independent variable (x)
in the first column and the dependent variable (y) in the
second column (e.g. "mydata").
2. Make sure the latest version of ipeak.m is in the Matlab path. (These
instructions apply to any version since 5.8). Type ipeak(mydata);oripeak(x,y);
3. Matlab displays the data in the Figure window, with the
entire signal in the lower panel and a zoomed-in section in the
top panel. (In the figure below, the data are the historical
sunspot counts by year from this
data set.) Note: Make sure you don't click on the
“Show Plot Tools” button in the toolbar above the figure; that
will disable normal program functioning. If you do; close the
Figure window and start again.
4. Use the left and right cursor keys to
pan back and forth across the signal...
To pan faster, use the <
and > keys. To pan by one point, use the [
and ] keys.
Use the up and down cursor
keys to zoom in and out.
To zoom faster, use the / and ' keys.
5. Use the A and Z keys to adjust the Amplitude
Threshold (AmpT) to eliminate peaks that are too small to
be of interest.
The current value of AmpT is displayed at the bottom of the
6. Use the S and X keys to adjust the Slope
Threshold (SlopeT) to discriminate on the basis of peak
width. Larger values of this parameter will neglect broad
features of the signal. (I'm using a different signal here).
The current value of SlopeT is displayed at the bottom of the
7. Use the D and C keys
to adjust the Smooth Width (SmoothW), the width of
the smooth function that is applied to data before the slope
is measured. Larger values of SmoothWidth will neglect
narrow, sharp features. (In this figure the data are from ipeakdemo.m.)
The current value of SmoothW is displayed at the bottom of the
8. Use the F and V keys to adjust the Fit
Width (FitW) to adjust the number of points around the
"top part" of the (unsmoothed) peak that are taken to estimate
the peak heights, positions, and widths.
The current value of FitW is displayed at the bottom
of the window.
9. Use the Space and Tab keys to jump to the next
and previous detected peaks. The measured peak
parameters for the selected peak are displayed on the left side
of the upper panel.
10. Use the Shift-G key to cycle between
Gaussian, Lorentzian, and flat-top shape modes. The current mode
is shown at the top of the window. The measured peak parameters
change accordingly. In this example, the peak is much more
nearly Gaussian, so the Gaussian mode gives a better fit and
more accurate values.
11. Use the T key to cycle between baseline correction
(Autozero) modes: None, Linear, Quadratic,
and Flat. The current mode is displayed at the top of
the window. The measured peak parameters change
accordingly. In this example, the baseline seems to be
linear, tilting down from left to right, so the Linear mode
gives a better fit and more accurate values.
12. Use the Y key to switch the Y axis between linear
and log mode. In this example, the dynamic range of the Y
values is so large that it's much easier to see on a log Y axis.
The y-axis label of the bottom panel changes accordingly.
13. Press the R key to display the peak report
table (for the historical sunspot data in sunspots.txt):
Gaussian shape mode (press Shift-G to change)
Amplitude Threshold (AmpT) = 19.02
Slope Threshold (SlopeT) = 0.0048225
Smooth Width (SmoothW) = 5 points
Fit Width (FitW) = 5 points
No baseline correction Peak#
43.374 4.1307 190.74 2
101.73 5.6906 616.28
106.81 4.9657 564.67
73.725 6.3741 500.28
71.524 6.0076 457.45
103.35 5.1104 562.29 ..... etc
14. Press the E key to display the peak statistics
Peak Summary Statistics 26 peaks detected No baseline correction
Width Area Maximum 15.153
195.8527 8.356 1025.5604 Minimum 8.2455
41.5679 4.1307 190.7358 Mean
11.0096 96.5382 5.6021
569.2662 % STD 13.9588
38.2597 15.4761 36.6246
This shows the well-known 11-year sunspot period as the mean of
the interval. Plots of the histograms are also shown in Figure
15. Press the U key to switch
between peak and valley modes.
16. Press the N key to perform
a (Normal) curve fit all numbered peaks in the upper
window. Alternatively, press the M key
to perform a (Multiple) curve fit all numbered peaks in
the entire signal. The curve fit results are displayed in Figure
2 just as they are for the peakfit
function and printed out in the command window.
17. Press K to display the complete set of keystroke
commands of the current version. Later versions will have
additional functions and keystroke commands, but the ones
covered here will remain. See PeakFindingandMeasurement.htm#ipeak.