Hello everyone. I've been writing Chebyshev code but I have problem.
function pol=cheby(n,x)toplam=0;if(n==0) pol=1;elseif(n==1) pol=x;else for n=0:6 pol=toplam + 2.*(x).*cheby(n-1,x)-cheby(n-2,x);endend
It goes to infinite recursion. When I do it one by one with elseif it works. How can I work it ? (I want to work it for n=0,1,2,3,4,5,6)
Best Answer