📄 sinc.m
字号:
% MATLAB SIMULATION OF NSA FS-1016 CELP v3.2
% COPYRIGHT (C) 1995-99 ANDREAS SPANIAS AND TED PAINTER
%
% This Copyright applies only to this particular MATLAB implementation
% of the FS-1016 CELP coder. The MATLAB software is intended only for educational
% purposes. No other use is intended or authorized. This is not a public
% domain program and distribution to individuals or networks is strictly
% prohibited. Be aware that use of the standard in any form is goverened
% by rules of the US DoD. Therefore patents and royalties may apply to
% authors, companies, or committees associated with this standard, FS-1016. For
% questions regarding the MATLAB implementation please contact Andreas
% Spanias at (480) 965-1837. For questions on rules,
% royalties, or patents associated with the standard, please contact the DoD.
%
% ALL DERIVATIVE WORKS MUST INCLUDE THIS COPYRIGHT NOTICE.
%
% ******************************************************************
% SINC
%
% PORTED TO MATLAB FROM CELP 3.2a C RELEASE
% 7-5-94
%
% ******************************************************************
%
% DESCRIPTION
%
% Evaluate the sinc function
%
% DESIGN NOTES
%
% sinc(x) = sin( pi * x ) / ( pi * x )
%
% VARIABLES
%
% INPUTS
% arg - Point(s) at which to evaluate sinc(x)
%
% OUTPUTS
% s - Value(s) of the sinc function
%
% INTERNALS
% nulls - Locations of 0s in the input vector
% nullcnt - Number of 0s in the input vector
%
% ******************************************************************
function s = sinc( arg )
% FIND ZEROS IN THE INPUT VECTOR
nulls = find( arg == 0 );
nullcnt = size( nulls );
% EVALUATE SINC AT ALL POINTS
s = sin(pi*arg) ./ (pi*arg);
% REPLACE NANs WITH 1.0 FOR POINTS EVALUATED AT THE ORIGIN
if nullcnt ~= 0
s( nulls ) = ones( nullcnt );
end
% RETURN A COLUMN VECTOR
s = s';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -