envelope包络与findpeaks求极值点包络对比

matlab 自带函数:function [upperEnv,lowerEnv] = envelope(x, n, method)
函数可使用三种方式计算:如下matlab帮助文档:

%   [YUPPER,YLOWER] = ENVELOPE(X,N,ENVTYPE) specifies the type of envelope
%   to return. The default is 'analytic':
%      'analytic' - returns the analytic envelope via an N-tap FIR filter
%      'rms'      - returns the RMS envelope of X over a sliding window
%                   of N samples.  
%      'peak'     - returns the peak envelope of the signal using a spline
%                   over local maxima separated by at least N points.

方法一:
peak:使用样条返回信号的峰值包络线(由至少N个点分隔的局部极大值)
方法二:
对比直接利用findpeaks函数查找峰值,然后用插值interp1得到包络线;

envelope包络与findpeaks求极值点包络对比_第1张图片
N = length(x);
[pks,p]=findpeaks(x);
return=interp1([0 p N+1],[0 x§ 0],1:N,‘pchip’);

你可能感兴趣的:(matlab)