function drawgrid1(gX,gY,gZ,col)
%Function to display grid data to save to eps file (Matlab meshgrid function does not correctly save to eps)
hold on
if nargin<4
    col=[0 0 0];
end
if nargin==3 && size(gZ,1)>1 || nargin==4
    for k=1:size(gX,1) %drawing lines instead of mesh b/c mesh won't save to eps files
        plot3(gX(k,:),gY(k,:),gZ(k,:),'Color',col,'LineWidth',.5);
    end
    for j=1:size(gX,2)
        plot3(gX(:,j),gY(:,j),gZ(:,j),'Color',col,'LineWidth',.5);
    end
    
elseif nargin==3 && size(gZ,1)==1 || nargin==2
    for k=1:size(gX,1) %drawing lines instead of mesh b/c mesh won't save to eps files
        plot(gX(k,:),gY(k,:),'Color',col,'LineWidth',.5);
    end
    for j=1:size(gX,2)
        plot(gX(:,j),gY(:,j),'Color',col,'LineWidth',.5);
    end
elseif nargin<2
    error('Not enough input arguments');
end

end

