📄 chebyfun.m
字号:
function T = chebyfun(n,z,ty)
% CHEBYFUN Chebyshev polynomials.
%
% Y = CHEBYFUN(N,X,1) Chebyshev polynomial of first kind T(x)
% Y = CHEBYFUN(N,X,2) Chebyshev polynomial of second kind U(x)
% N = order of polynomial. N must be a SCALAR
%
% CHEBYFUN (with no input arguments) invokes the following example:
%
% % Plot the Chebyshev polynomial T_3(x) (order 3) over (-1.2 1.2)
% >>x = -1.2:.05:1.2;
% >>y = chebyfun(3,x,1);
% >>plot(x,y),grid
% 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 chebyfun,disp('Strike a key to see results of the example')
pause,x=-1.2:.05:1.2;y=chebyfun(3,x,1);plot(x,y),grid,return,end
tol=2e-16;
if nargin < 3,ty=1;end
if ty<1|ty>2,error('Type must be 1 or 2'),return,end
if any(rem(n,1)),error('The order must be an integer'),return,end
x=z+(z==inf)+(z==-inf);
if ty==1
T=ghgf(2,1,[-n n 1 1],[0.5 1 1 1],(1-x)/2,tol);
else
T=(n+1)*ghgf(2,1,[-n n+2 1 1],[3/2 1 1 1],(1-x)/2,tol);
end
if any(any(z==inf)),i=find(z==inf);[m1,n1]=size(i);T(i)=inf*ones(m1,n1);end
if any(any(z==-inf)),
i=find(z==-inf);[m1,n1]=size(i);
if rem(n,2)==0,T(i)=inf*ones(m1,n1);else,T(i)=-inf*ones(m1,n1);end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -