⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 peak finding and measurement.htm

📁 收集的一组跟噪声产生以及消除、衡量消噪性能指标的MATLAB仿真源代码
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0066)http://www.wam.umd.edu/~toh/spectrum/PeakFindingandMeasurement.htm -->
<HTML><HEAD><TITLE>Peak Finding and Measurement</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR></HEAD>
<BODY>
<CENTER><A href="http://www.wam.umd.edu/~toh/spectrum/TOC.html">[Table of 
Contents]</A> <A href="http://www.wam.umd.edu/~toh/spectrum/TOC.html">[Previous 
section]</A> <A 
href="http://www.wam.umd.edu/~toh/spectrum/InteractiveSmoothing.htm">[Next 
section]</A> </CENTER>
<P>
<H2>Peak Finding and Measurement, Version 1.6 October 26, 2006</H2>A fast, 
customizable Matlab routine for locating and measuring the peaks in noisy 
time-series data sets. Determines the position, height, and width of each peak 
by least-squares curve-fitting. It can find and measure 1000 peaks in a 
1,000,000 point signal in 8 seconds. <A 
href="http://www.wam.umd.edu/~toh/spectrum/Peakfinder.zip">Click here to 
download the ZIP file "Peakfinder.zip"</A> that also includes supporting 
functions, several self-contained demos to show how it works, and an interactive 
version with sliders for adjusting the peak finding criteria in real-time. 
Version 1.6 works with a wider range of signal types and includes baseline 
(background) correction. You can also download it from the <A 
href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1095233&amp;objectType=author">Matlab 
File Exchange</A>. 
<P>
<H3>The findpeaks function</H3><TT>function 
P=findpeaks(x,y,SlopeThreshold,AmpThreshold,SmoothWidth,FitWidth)</TT><BR>This 
is the basic function to locate and measure the positive peaks in a noisy data 
sets. It detects peaks by looking for downward zero-crossings in the smoothed 
first derivative that exceed SlopeThreshold and peak amplitudes that exceed 
AmpThreshold, and determines the position, height, and approximate width of each 
peak by least-squares curve-fitting the top part of the peak. Returns a list (in 
matrix P) containing the peak number and the estimated position, height, and 
width of each peak. The data are passed in the vectors x and y (x = independent 
variable, y = dependent variable). The other four parameters are 
user-adjustable: 
<UL><B>SlopeThreshold</B> - Slope of the smoothed first-derivative that is 
  taken to indicate a peak. This discriminates on the basis of peak width. 
  Larger values of this parameter will neglect broad features of the 
  signal.<BR><B>AmpThreshold</B> - Discriminates on the basis of peak height. 
  Any peaks with height less than this value are ignored.<BR><B>SmoothWidth</B> 
  - Width of the smooth function that is applied to data before the slope is 
  measured. Larger values of SmoothWidth will neglect small, sharp features. A 
  reasonable value is typically about equal to 1/2 of <I>the number of data 
  points</I> in the half-width of the peaks. <BR><B>FitWidth</B> - The number of 
  points around the "top part" of the (unsmoothed) peak that are taken to 
  estimate the peak heights, positions, and widths. A reasonable value is 
  typically about equal to 1/2 of <I>the number of data points</I> in the 
  half-width of the peaks. The minimum value is 3. </UL>
<P>
<H3>DemoFindPeak</H3>
<TABLE cellPadding=10 border=1>
  <TBODY>
  <TR>
    <TD><A href="http://www.wam.umd.edu/~toh/spectrum/DemoFindPeak.GIF"><IMG 
      src="Peak Finding and Measurement.files/DemoFindPeakSmall.gif" 
      ?alt="Click to view enlarged figure"><BR>
      <CENTER>Click to view enlarged figure</CENTER></A></TD>
    <TD>A simple demonstration script using the findpeaks function on noisy 
      synthetic data. Numbers the peaks and prints out the P matrix in the 
      Matlab command window: <PRE>    Peak #   Position   Height    Width
P =
    1.0000   10.0235    0.1814    1.7506
    2.0000   29.9964    0.6412    1.9931
    3.0000   50.0205    0.4315    2.1433
    4.0000   70.0120    1.3935    2.0202
    5.0000   79.9567    0.2580    1.8267
    6.0000  100.0086    1.0862    2.0306
    ......
</PRE></TD></TR></TBODY></TABLE><BR>
<H3>FindPeakSliders</H3>
<TABLE cellPadding=10 border=1>
  <TBODY>
  <TR>
    <TD><A href="http://www.wam.umd.edu/~toh/spectrum/Findpeaks.GIF"><IMG 
      src="Peak Finding and Measurement.files/FindPeaksSmall.gif" 
      ?alt="Click to view enlarged figure"><BR>
      <CENTER>Before baseline correction</CENTER></A>
      <P><A href="http://www.wam.umd.edu/~toh/spectrum/FindPeaksBC.GIF"><IMG 
      src="Peak Finding and Measurement.files/FindPeaksBCSmall.gif" 
      ?alt="Click to view enlarged figure"><BR>
      <CENTER>After baseline correction</CENTER></A></TD>
    <TD>Interactive findpeaks script for your own data. Requires Matlab 6.5. 
      This can be used to determine what values of the parameters give the most 
      reliable peak detection. Load your data set into the vectors x and y (x = 
      independent variable, y = dependent variable), then run this m-file and 
      adjust the sliders to change the four arguments of the peakfind function. 
      The four sliders correspond to the arguments of the findpeaks function 
      described above: <B>SlopeThreshold (SlopeT)</B>, <B>AmpThreshold 
      (AmpT)</B>, <B>SmoothWidth (Smooth)</B>, and <B>FitWidth (Fit)</B>. The 
      range of these sliders is easily changed in lines 65 - 70 to suit a wide 
      range of data types. The <B>BG</B> button is used for baseline 
      (background) subtraction: click once on the <B>BG</B> button, then click 
      on the baseline at five points starting to the left of the lowest x-value 
      and ending to the right of the higest x-value. The background will be 
      subtracted. You can repeat as needed. (You can also change the number of 
      baseline points by changing BaselinePoints in the function BG.m). Peak 
      number and the estimated position, height, and width of each peak is 
      returned in the matrix P: <PRE>&gt;&gt; P
P =
    1.0000   45.0095    0.1328    4.0102
    2.0000   90.5301    0.3655    4.7127
    3.0000   94.9673    1.4075    4.0967
    ......
</PRE></TD></TR></TBODY></TABLE><BR>
<H3>DemoFindPeakSliders</H3>
<TABLE cellPadding=10 border=1>
  <TBODY>
  <TR>
    <TD><A 
      href="http://www.wam.umd.edu/~toh/spectrum/DemoFindPeaksSliders.GIF"><IMG 
      alt="Click to view enlarged figure" 
      src="Peak Finding and Measurement.files/DemoFindPeaksSlidersSmall.gif"><BR>
      <CENTER>Click to view enlarged figure</CENTER></A></TD>
    <TD>A self-contained interactive demonstration of FindPeakSliders applied 
      to noisy synthetic data set consisting of a random number of narrow peaks 
      superimposed on a gently curved background. Requires Matlab 6.5. Use the 
      sliders to explore the effect of the variables <B>SlopeThreshold 
      (SlopeT)</B>, <B>AmpThreshold (AmpT)</B>, <B>SmoothWidth (Smooth)</B>, and 
      <B>FitWidth (Fit)</B>, and the baseline correct (<B>BG</B>) button. Peak 
      number and the estimated position, height, and width of each peak is 
      returned in the matrix P. </TD></TR></TBODY></TABLE><BR>
<H3>DemoFindPeakSliders2</H3>
<TABLE cellPadding=10 border=1>
  <TBODY>
  <TR>
    <TD><A 
      href="http://www.wam.umd.edu/~toh/spectrum/DemoFindPeaksSliders2.GIF"><IMG 
      src="Peak Finding and Measurement.files/DemoFindPeaksSliders2Small.gif"><BR>
      <CENTER>Click to view enlarged figure</CENTER></A></TD>
    <TD>A self-contained interactive demonstration of FindPeakSliders applied 
      to a data set containing four simple peaks with increasing peak height and 
      peak width. Use this to understand the difference between the variables 
      SlopeThreshold (SlopeT), which discriminates on the basis of peak width, 
      and AmpThreshold (AmpT), which discriminates on the basis of peak 
      amplitude. Peak number and the estimated position, height, and width of 
      each peak is returned in the matrix P: <PRE>&gt;&gt; P
P =
    1.0000   49.9096    1.9895   20.1960
    2.0000  126.1034    3.0585   42.3508
    3.0000  201.3947    4.0752   63.3354
    4.0000  299.9242    4.9925   82.2000

</PRE></TD></TR></TBODY></TABLE><BR>
<P>
<H3>FindPeakSlidersG</H3>
<TABLE cellPadding=10 border=1>
  <TBODY>
  <TR>
    <TD><A href="http://www.wam.umd.edu/~toh/spectrum/DemoFindPeaksG.GIF"><IMG 
      src="Peak Finding and Measurement.files/DemoFindPeaksGSmall.gif" 
      ?alt="Click to view enlarged figure"><BR>
      <CENTER>Click to view enlarged figure</CENTER></A></TD>
    <TD></A><A 
      href="http://www.wam.umd.edu/~toh/spectrum/DemoFindPeaksGzoom.GIF"><IMG 
      alt="Click to view enlarged figure" 
      src="Peak Finding and Measurement.files/DemoFindPeaksGzoomSmall.gif"><BR>
      <CENTER>Click to view enlarged figure</CENTER></A></TD>
    <TD></TD></TR></TBODY></TABLE>Interactive findpeaks script with peak-zoom 
feature, for pre-defined data in x,y. Requires Matlab 6.5. Load a typical data 
set into the vectors x,y, then run this m-file and adjust the sliders to 
determine what values of the parameters give the most reliable peak detection. 
Peak number and position, height, and width of each peak is returned in the 
matrix P. This version has an additional slider, <B>Peak</B>, which zooms in on 
any one of the detected peaks and shows the fitted top of the peak (FitWidth) as 
a blue curve. To see all the peaks, set the Peaks slider to zero (all the way 
down).<BR>Note: If the slider ranges are not appropriate for your data, change 
them in lines 63-69. 
<H3>DemoFindPeakSlidersG</H3>A self-contained interactive demonstration of 
FindPeakSlidersG. Requires Matlab 6.5. 
<H3><A href="http://www.wam.umd.edu/~toh/spectrum/Peakfinder.zip">ZIP file</A> 
containing all of the above peakfind functions and demos.</H3>
<H3>Video Demonstration of FindPeakSliders</H3>This is a 26-second, 1.4 MByte 
video (<A 
href="http://www.wam.umd.edu/~toh/spectrum/PeakFind2.wmv">PeakFind2.wmv</A>) of 
FindPeakSliders (version 1.1), showing the effect of varying the four parameters 
<B>SlopeThreshold (SlopeT)</B>, <B>AmpThreshold (AmpT)</B>, <B>SmoothWidth</B>, 
and <B>FitWidth</B> (labeled "PeakWidth" in this video). 
<P>Tom O'Haver<BR>Professor Emeritus<BR>Department of Chemistry and 
Biochemistry<BR>The University of Maryland at College Park<BR>toh@umd.edu<BR><A 
href="http://www.wam.umd.edu/~toh">http://www.wam.umd.edu/~toh</A> <BR>
<HR>

<CENTER><A href="http://www.wam.umd.edu/~toh/spectrum/TOC.html">[Table of 
Contents]</A> <A href="http://www.wam.umd.edu/~toh/spectrum/TOC.html">[Previous 
section]</A> <A 
href="http://www.wam.umd.edu/~toh/spectrum/InteractiveSmoothing.htm">[Next 
section]</A> </CENTER></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -