标题:[求助]怎样得到包络图啊
只看楼主
lchy
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-6-24
 问题点数:0 回复次数:1 
[求助]怎样得到包络图啊
我有一个振荡图,我知道它的坐标和对应的值,但是我只想得到该振荡图的包络图,就是它的轮廓图,请问应该怎么做啊?

非常感谢
搜索更多相关主题的帖子: 包络 
2006-06-24 20:56
Genial
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:175
专家分:0
注 册:2006-3-31
得分:0 
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, <WangLeiBox@hotmail.com>, 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



% 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);
2006-06-24 21:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-74602-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018425 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved