from
Gauss-Chevyshev
by Jordi Soler Penades
Integrates function using Gauss-Chevyshev method
|
| I=chevygauss(f,a,b,n)
|
function I=chevygauss(f,a,b,n)
%I=chevygauss(f,a,b,n)
%Aproximates integral using Gauss-Chevyshev method
%Edit function 'f' to integrate y=f(x).
%Chevyshev polynomial
p=chevypol(n);
%Roots of the polynomial
x=roots(p(n+1,:));
%Change of the integration variable if boundaries if necessary
if a~=-1 | b~=1
y=fleg(f,a,b);
G=subs(y,x);
else
G=feval(f,x); %Function evaluation on the nodes
end
%Coeficient calculation
for i=1:n
C(i)=pi/n;
end
%Nodes*coeficients
I=dot(C,G);
|
|
Contact us at files@mathworks.com