I am writting this function kahan(x) which implements kahan's method for computing the sum of a vector x. but it gives me an error on line two. see if you can find a way to fix it.
function s=kahan(x)
n=length(x)
sm=o; dif=0;
for k=1:n
y=x(k)-dif;
temp=sm;
sm=temp+y;
dif=(sm-temp) - y;
end