envelope.m

来自「Matlab communication toolbox.」· M 代码 · 共 49 行

M
49
字号
function out = envelope(in,fo)

% ENVELOPE ....	Envelope detector.
%
%	Y = ENVELOPE(X,fo) rectifies the input sequence X using a diode and
%		then low-pass filters the rectified sequence.  The bandwidth
%		of the low-pass filter is set to "fo" Hz.

%	AUTHORS : M. Zeytinoglu & N. W. Ma
%             Department of Electrical & Computer Engineering
%             Ryerson Polytechnic University
%             Toronto, Ontario, CANADA
%
%	DATE    : August 1991.
%	VERSION : 1.0

%===========================================================================
% Modifications history:
% ----------------------
%	o   Added "checking"  11.30.1992 MZ
%	o	Tested (and modified) under MATLAB 4.0/4.1 08.16.1993 MZ
%===========================================================================

global START_OK;
global BELL;
global WARNING;

check;

%------------------------------------------------------------------------
%	Input parameter control
%------------------------------------------------------------------------
if (nargin ~= 2)
   error(eval('eval(BELL),eval(WARNING),help envelope'));
   return;
end   

len = length(in);
%
%   apply the input signal to a diode
%
y = zeros(len,1);
index = (in>0);
y(index) = in(index);
%
%   the output is fed to the LP filter
%
out = lpf(fo,y);

⌨️ 快捷键说明

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