该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
本人不懂matlab,现在有网上找的线程的寻峰算法函数,我已经可以从程序中调用,但是对数学这块不懂,我不知道该传什么样的参数值,以下是.m寻峰算法的说明,代码有点多,在2楼发
% autofindpeaks(x,y,SlopeThreshold,AmpThreshold,smoothwidth,peakgroup,smoothtype)
% Automatic peak finder that locates and measures the positive peaks in a
% noisy x-y time series data. similar to findpeaksG or findpeaskSG except
% that the peak detection parameters SlopeThreshold, AmpThreshold,
% smoothwidth, peakgroup, smoothtype can be omitted and the function will
% calculate trial values based on the number of data points and/or the
% optional peak density (the last of 3 arguments after x and y). Returns a
% table (P) of peak number, position, absolute peak height, peak-valley
% difference, perpendicular drop area, and tangent skim area of each peak.
% Detects peaks by looking for downward zero-crossings in the first
% derivative whose upward slopes exceed SlopeThreshold. If Peakgroup=0 the
% local maximum is taken as the peak height and position. For best results,
% remove the background from the data before using this function. Optional
% input arguments "slopeThreshold", "ampThreshold" and "smoothwidth"
% control peak sensitivity of each segment. Higher values will neglect
% smaller features. "Smoothwidth" is a vector of the widths of the smooths
% applied before peak detection; larger values ignore narrow peaks. If
% smoothwidth=0, no smoothing is performed. "Peakgroup" is a vector of the
% number points around the top part of the peak that are taken for
% measurement. The argument "smoothtype" determines the smooth algorithm:
% If smoothtype=1, rectangular (sliding-average or boxcar) If
% smoothtype=2, triangular (2 passes of sliding-average) If smoothtype=3,
% pseudo-Gaussian (3 passes of sliding-average)
% Run testautopeaks.m to test and demonstrate this function.
% In version 1.1, [P,DetectionParameters]=autofindpeaks...also returns the
% peak detection parameters as a 4-element row vector.
% See http://terpconnect.umd.edu/~toh/spectrum/Smoothing.html and
% http://terpconnect.umd.edu/~toh/spectrum/PeakFindingandMeasurement.htm
% (c) T.C. O'Haver, 2016. Version 1.1, February, 2017
%
% The script testautofindpeaks.m runs all the examples below, additionally
% plotting the data and numbering the peaks (like autofindpeaksplot.m)
%
% Example 1: One input argument; data in single vector
% x=[0:.01:5];y=sin(10*x);autofindpeaks(y);
%
% Example 2: One input argument; data in two columns of a matrix
% x=[0:.01:5]';y=x.*sin(x.^2).^2;M=[x y];autofindpeaks(M);
%
% Example 3: Two input arguments; data in separate x and y vectors
% x=[0:.1:100];y=(x.*sin(x)).^2;autofindpeaks(x,y);
% or x=[0:.005:2];y=humps(x);P=autofindpeaks(x,y)
%
% Example 4: Additional input argument (after the x,y data) to control
% peak sensitivity; higher numbers for more peaks:
% x=[0:.1:10];y=5+5.*sin(x)+randn(size(x));autofindpeaks(x,y,3);
% or x=[0:.1:100];y=5+5.*cos(x)+randn(size(x));autofindpeaks(x,y,10);
% or x=[0:.1:1000];y=5+5.*cos(x)+randn(size(x));autofindpeaks(x,y,100)
%
% Example 5: Seven input arguments. Specify all peak detections parameters
% x=1:.2:100;
% y=gaussian(x,40,10)+gaussian(x,50,10)+.01.*randn(size(x));
% autofindpeaks(x,y,0.00026015,0.031007,19,21,3)
%
% Example 6: Seven input arguments. Specify all peak detections parameters, in
% this case using vectors to optimize for peaks with very different widths.
% x=1:.2:100;
% y=gaussian(x,20,1.5)+gaussian(x,80,30)+.02.*randn(size(x));
% plot(x,y,'c.')
% P=autofindpeaks(x,y,[0.001 .0001],[.2 .2],[5 10],[10 100],3)
% text(P(:,2),P(:,3),num2str(P(:,1)))
% disp(' ')
% disp(' peak # Position Height Width Area')
% disp(P)
%
% Example 7: Find, measure, and plot noisy peaks with unknown positions
% x=-50:.2:50;
% y=exp(-(x).^2)+exp(-(x+50*rand()).^2)+.02.*randn(size(x));
% plot(x,y,'m.')
% P=autofindpeaks(x,y);
% text(P(:,2),P(:,3),num2str(P(:,1)))
% disp(' peak # Position Height Width Area')
% disp(P)
%
% Note: You can pass the detection parameters found by autofindpeaks to
% other functions, such as measurepeaks. For example:
% x=[0:.1:50];y=5+5.*sin(x)+randn(size(x));[P,A]=autofindpeaks(x,y,3);
% P=measurepeaks(x,y,A(1),A(2),A(3),A(4),1);
%
% Related functions:
% autofindpeaksplot.m, findpeaksG.m, findvalleys.m, findpeaksL.m,
% findpeaksb.m, findpeaksb3.m, findpeaksplot.m, peakstats.m, findpeakSNR.m,
% findpeaksGSS.m, findpeaksSG, findpeaksLSS.m, findpeaksfit.m, findsteps.m,
% findsquarepulse.m, idpeaks.m, measurepeaks.m
% Copyright (c) 2017 Thomas C. O'Haver
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
% copies of the Software, and to permit persons to whom the Software is
% furnished to do so, subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included in
% all copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
% THE SOFTWARE.
%
我只会从程序中传入x轴与y轴坐标,通过翻译那些什么斜率阈值之类的,完全不知道什么意思,我需要从类似以下这个峰谱图中(共32000+个坐标),找到大约50-300个峰,有很多峰很弱,应该需要灵敏度较高
通过这个寻峰算法的默认参数(x,y),只能寻到几个非常强的峰,该怎么调整参数才能找到那些弱峰呢