rc.m

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

M
52
字号
function  [out] = rc(fc,in)

% RC ..........	First-order rc lowpass filter.
%
% 	Y = RC(fc,X) returns vector Y obtained through low-pass filtering the
%		input sequence X. "fc" is the cutoff frequency of the filter.
%

%	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 SAMPLING_CONSTANT;
global SAMPLING_FREQ;
global BINARY_DATA_RATE;
global BELL;
global WARNING;

check;

if (nargin ~= 2)
   error(eval('eval(BELL),eval(WARNING),help LPF'));
   return;
end

%----------------------------------------------------------------------------
%	set the sampling frequency fs, and check its consistency
%----------------------------------------------------------------------------

fs = SAMPLING_FREQ;			% Default sampling frequency.
if (fc > (fs/2))
   error('Cut-off frequency fc must be <= (fs/2)')
end

passband = [fc/(fs/2)];			% Passband specification
[Bc,Ac]  = butter(1,passband);
[out1 out2]  = filter(Bc,Ac,in);
out3 = filter(Bc,Ac,zeros(1,SAMPLING_CONSTANT),out2);
out = [out1(:)' out3(:)'];

⌨️ 快捷键说明

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