function s=sumofsquares(x) n=length(x); if n>1000 disp('too big') return end s=0; for j=1:n s=s+x(j)^2; end