필터 지우기
필터 지우기

chebyshevT is too slow

조회 수: 4 (최근 30일)
htrh5
htrh5 2016년 1월 6일
편집: htrh5 2016년 1월 6일
This function takes an eternity to compute. I have written a workaround that works about 75 times faster for me but I am curious why this is so. It is probable that many other special functions compute slower than they need to.
N=4096;
w=(-N/2:N/2-1)/sqrt(N);
n=8;
tic;x1=chebyshevT(n,w);toc;%2.720533
tic;
A=zeros(n+1,n+1);
for i = 1:n+1
for j = 1:n+1
A(i,j)= (i-1).^(j-1);
end
end
coefs = A\chebyshevT(n,(1:n+1)-1)';
x2 = polyval(flipud(coefs),w);
toc;%0.035399
sqrt( sum((x1-x2).^2)/sum(x1.^2) )
max( abs(x1-x2)/x1 )

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by