我要加入 登录
声振论坛 返回首页

lonsvm的个人空间 http://home.vibunion.com/?138233 [收藏] [复制] [分享] [RSS]

日志

一种有效的包络线算法

已有 587 次阅读2012-3-12 17:41 |

function [up,down] = envelope(x,y,interpMethod)
%ENVELOPE gets the data of upper and down envelope of the known input (x,y).
%
%   Input parameters:
%    x               the abscissa of the given data
%    y               the ordinate of the given data
%    interpMethod    the interpolation method
%
%   Output parameters:
%    up      the upper envelope, which has the same length as x.
%    down    the down envelope, which has the same length as x.
%
%   See also DIFF INTERP1
%   Designed by: Lei Wang, <[email]WangLeiBox@hotmail.com[/email]>, 11-Mar-2003.
%   Last Revision: 21-Mar-2003.
%   Dept. Mechanical & Aerospace Engineering, NC State University.
% $Revision: 1.1 $  $Date: 3/21/2003 10:33 AM $
if length(x) ~= length(y)
    error('Two input data should have the same length.');
end
if (nargin < 2)|(nargin > 3), error('Please see help for INPUT DATA.');
elseif (nargin == 2),  interpMethod = 'linear'; end
  http://www.chinavib.com/forum-viewthread-tid-32967-extra-page%3D1-page-1.html
 
% Find the extreme maxim values and the corresponding indexes
%----------------------------------------------------
extrMaxValue = y(find(diff(sign(diff(y)))==-2)+1);
extrMaxIndex =   find(diff(sign(diff(y)))==-2)+1;
% Find the extreme minim values and the corresponding indexes
%----------------------------------------------------
extrMinValue = y(find(diff(sign(diff(y)))==+2)+1);
extrMinIndex =   find(diff(sign(diff(y)))==+2)+1;
up = extrMaxValue; up_x = x(extrMaxIndex);
down = extrMinValue; down_x = x(extrMinIndex);
% Interpolation of the upper/down envelope data
%----------------------------------------------------
up = interp1(up_x,up,x,interpMethod);
down = interp1(down_x,down,x,interpMethod);

全部作者的其他最新日志

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 我要加入

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-9 02:19 , Processed in 0.035948 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部