📄 chcoeff.m
字号:
function [z,y] = chcoeff(n,ty)
% CHCOEFF Coefficients of the nth order Chebyshev polynomial.
%
% [Z,Y] = CHCOEFF(N,TY) Coeffs of an Nth order Chebyshev polynomial.
% TY=1 for T(n) (first kind), TY=2 for U(n) [second kind][DEFAULT: TY=1]
% Z contains the N+1 coefficients of the Nth order polynomial.
% Y is a matrix whose N rows are Cheby poly. coeffs from order 1 to N.
%
% CHCOEFF (with no input arguments) invokes the following example:
%
% % Find coefficients of all Chebyshev polynomials T(n) to order 5.
% >>[a,b] = chcoeff(5)
% 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
%We use the recursion T(n)=2*x*T(n-1) - T(n-2) with T(0)=1,T(1)=x
%For U, we have: U(n)=2*x*U(n-1) - U(n-2) BUT with U(0)=1,U(1)=2x
if nargin==0,help chcoeff,disp('Strike a key to see results of the example')
pause,[a,b]=chcoeff(5),return,end
if nargin<2,ty=1;end
if n==0,z=1;y=1;return,end
y=zeros(n+1,n+1);y(1,n+1)=1;
if ty==1,y(2,n)=1;else,y(2,n)=2;end
for k=3:n+1
pk=[2*y(k-1,2:n+1) 0]-y(k-2,:);y(k,:)=pk;
end
z=y(n+1,:);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -