function y=segment(x0,x1,y0,y1,x)
  y=y0+(y1-y0)*(x-x0)/(x1-x0);
endfunction
