📄 invsinc.m
字号:
function b=invsinc(x,tol)
% INVSINC Inverse of sinc function.
%
% C = INVSINC(X,TOL) returns the inverse of sinc function
% TOL = required tolerance, TOL [Default: TOL = 1e-7].
%
% NOTE: INVSINC requires |X| < 1
% NOTE: The value of C is returned over the mainlobe (0,1).
%
% INVSINC (with no input arguments) invokes the following example:
%
% % Let xa=sinc(0.25). Then invsinc(xa) should equal 0.25
% >>xa = sinc(0.25)
% >>xb = invsinc(xa)
% ADSP Toolbox: Version 2.0
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998
if nargin==0,help invsinc,disp('Strike a key to see results of the example')
pause,xa=sinc(0.25),ya=invsinc(xa),return,end
if nargin<2,tol=1e-7;end
if any(any(abs(x)>1)),error('invsinc requires |x| < 1'),break,end
a=0*x;b=0.5+a;c=1+a;kmax=100;k=0;
while any(any(abs(x-sinc(b))>tol)) & k<=kmax
k=k+1;fb=sinc(b);f=(x-fb);
c=b.*(f>0)+c.*(f<=0);
a=b.*(f<=0)+a.*(f>0);
b=0.5*(a+c);
end
if k>kmax,disp(['No convergence in ' num2str(kmax) ' iterations']),end
b=b.*(x>0 & x<1)+(x==0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -