# Thread: Scheme of aitken interpolation - octave code

1. ## Scheme of aitken interpolation - octave code

Hello,

Could anyone help me to write Aitken algoritm in actave?

Code:
function w = aitken(n)

for i = 0:0
for j = 1:n-1
W(i,j) = ((y(i)*(x(j)-x))-(y(j)*(x(i)-x)))/((x(j)-x(i));
for k = j+1:n
W(i,j,k) = ((W(i,j)*(x(k)-x))-(W(i,k)*(x(j)-x)))/(x(k)-x(j));
for m = k+1:
endfor
endfor
endfor

end

2. ## Re: Scheme of aitken interpolation - octave code

Hey fredros123.

What part are you having difficulty with?

The function value is going to be your W function as a function of x and the points you are interpolating which involve the (xi,yi) points.

So when you find W(x|(x1,y1)...(xn,yn)) you have your function taking in an x parameter and a set of points that are interpolated against.

You need to supply a vector of x values and a set of points which are just two row vectors and then you can plot the function based on your input x row vector.