## Multiple variable General polynomial least square plot
## Author: M. Turhan ÇOBAN
## Created: 2021-08-30

function retval = multpoly_plot(x,y,f,n)
    e=multpoly_least(x,y,f,n)
    n=length(y);
    xmin=0.0;
    xmax=4.0;
    ymin=0.0;
    ymax=4.0;
    m1=17;
    dx=(xmax-xmin)/(m1-1);
    x1=y1=linspace(xmin,xmax,m1);
    [xx,yy]=meshgrid (x1,y1);
    m2=m1*m1;
    for i=1:m1
      for j=1:m1
        xx1=xx(i,:);
        yy1=yy(j,:);
        xx2=[xx1;yy1];
        z(i,j)=multpoly_func(f,e,xx2,i);
      end
    end
    
   surfc(xx,yy,z); 
   retval=z;
end
