%read a file and plot
function draw(F,N)
fid=fopen(F,'r'); 
A=fscanf(fid,'%e',[N,inf]);
A=A.';
M=size(A,1);
if N==2
  plot(A(:,1),A(:,2));
elseif N==3
  count=0;
  for l=1:M
    if A(1)==A(l)
      count=count+1;
    else
      break;
    end 
  end
  X=zeros(count,M/count);Y=X;Z=X;
  for t=1:M
    X(t)=A(t,1);
    Y(t)=A(t,2);
    Z(t)=A(t,3);
  end
  figure
  mesh(X,Y,Z);
  figure
  plot3(X,Y,Z);
  figure
  contour(X,Y,Z);
  figure
  contour3(X,Y,Z);
else
disp('error input');
end
fclose(fid);
