function   qlr(x0,x,y)
n=length(x)
i=1;
j=2;
k=3;
h=1;
while ((i<n-3) && (j<n-2) && (k<n))
     while ((k<=n))
       x1=x(i);
     x2=x(j);
     x3=x(k);
     y1=y(i);
     y2=y(j);
     y3=y(k);

     while ((x1==x2) && (k<n))
        j=j+1;
        k=k+1;
     x2=x(j);
     x3=x(k);
     y2=y(j);
     y3=y(k);
     end
     while ((k<j) && (k<n))
       k=k+1;
     x3=x(k);
     y3=y(k);
     end
            while ((x2==x3) && (k<n))
             k=k+1;
     x3=x(k)
     y3=y(k);
    end
     while ((x2==x3) && (k<n))
      z(h)=0;
      b=sum(z)/(h-1)
    end
 z(h)=l(x0,x1,x2,x3,y1,y2,y3);
 h=h+1;
 k=k+1;
 end
i=i+1;
j=i+1;
k=j+1;
x1=x(i);
x2=x(j);
x3=x(k);
y1=y(i);
y2=y(j);
y3=y(k);
b=sum(z)/(h-1)
end
