## a general function
## for general polynomial curve fitting
## Author: M. Turhan ÇOBAN
## Created: 2021-08-22

function retval = gen_f (x,i)
      xx=0;
      if i==1
        xx=1.0;
      elseif i==2
        xx=x;
      elseif i==3
        xx=x*x;
      elseif i==4
        xx=x*x*x;
      elseif i==5
        xx=x*x*x*x;
      elseif i==6
        xx=x*x*x*x*x;
      elseif i==7
        xx=x*x*x*x*x*x;
      end
      retval=xx;
endfunction
