From: TideMan <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Help Please! Plotting X,Y,Z 3d surface
Date: Wed, 2 Dec 2009 19:19:01 -0800 (PST)
Lines: 26
Message-ID: <>
References: <>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: 1259810341 15892 (3 Dec 2009 03:19:01 GMT)
NNTP-Posting-Date: Thu, 3 Dec 2009 03:19:01 +0000 (UTC)
Injection-Info:; posting-host=; 
User-Agent: G2/1.0
X-HTTP-Via: 1.1 bc6
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: 
	Gecko/20091102 Firefox/3.5.5,gzip(gfe),gzip(gfe)
Xref: comp.soft-sys.matlab:589727

On Dec 3, 1:02 pm, sumeho <> wrote:
> Hi!
> I have an ascii file with x, y, z (latitude, longitude, elevation).
> Because these are coordinates and I guess the spacing is different, I
> am not able to simply plot (surf).
> I've read about using meshgrid for the x and y... I'm also getting an
> error if I just do surf(x,y,z)- not being the same dimensions.
> This is lidar data. I want to import the surface into matlab and run a
> hydrodynamic model on the surface elevation.
> Thank you!

If your distribution of points is not in a rectangular grid, meshgrid
will not work.
What you need is griddata.
And if you configure it correctly, you'll get exactly the arrays you
need for surf.

Alternatively, since you're plotting latitude and longitude, you may
need to transform them first using a mapping projection (like
Mercator), otherwise the map will be distorted, especially at high
latitudes.  Google m_map to get a (free) toolbox that does that for