📄 cheby.m
字号:
function [C,X,Y]=cheby(fun,n,a,b)%Input - fun is the string function to be approximated% - N is the degree of the Chebyshev interpolating polynomial% - a is the left endpoint% - b is the right endpoint%Output - C is the coefficient list for the polynomial% - X contains the abscissas% - Y contains the ordinates% NUMERICAL METHODS: Matlab Programs% (c) 2004 by John H. Mathews and Kurtis D. Fink% Complementary Software to accompany the textbook:% NUMERICAL METHODS: Using Matlab, Fourth Edition% ISBN: 0-13-065248-2% Prentice-Hall Pub. Inc.% One Lake Street% Upper Saddle River, NJ 07458if nargin==2, a=-1;b=1;endd=pi/(2*n+2);C=zeros(1,n+1);for k=1:n+1 X(k)=cos((2*k-1)*d);endX=(b-a)*X/2+(a+b)/2;x=X;Y=eval(fun);for k =1:n+1 z=(2*k-1)*d; for j=1:n+1 C(j)=C(j)+Y(k)*cos((j-1)*z); endendC=2*C/(n+1);C(1)=C(1)/2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -