

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
>Numerical Analysis_9th edition >page 537-536
Typology: Exercises
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Chebyshev’s coding based on Algorithm function [R] = ChebyshevRatApprox(f,m,n) syms theta x N = m+n; a = zeros(1,N+m+1); a(1) = (2/pi)(int(f(cos(theta)),theta,[0 pi])); for i = 2:N+m+ a(i) = (2/pi)(int(f(cos(theta))cos((i-1)theta),theta,[0 pi])); end p = zeros(1,n+1); q = zeros(1,m+1); A = zeros(N+1); b = zeros(1,N+1); q(1) = 1; for i = 1:N+ for j = 1:i if j<=n+ A(i,j) = 0; end if i<=n+ A(i,i) = 1; end for j = i+1:n+ A(i,j) = 0; end for j = n+2:N+ if i~= if abs(i-j+n+1)== A(i,j) = -(a(i+j-n-1)+a(2))/2;
else A(i,j) = -(a(i+j-n-1)+a(abs(i-j+n+1)))/2; end else A(i,j) = -a(j-n)/2; end end if i~= b(i) = a(i); else b(i) = a(i)/2; end end end cc = A\b.'; CC = cc.'; p(1:n+1) = CC(1:n+1); q(2:m+1) = CC(n+2:N+1); for i=1:N+ T(i) = chebyshevT(i-1,x); end for i = 1:n+ P(i) = p(i)T(i); end for i = 1:m+ Q(i) = q(i)T(i); end