Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Help Please! Plotting X,Y,Z 3d surface

Subject: Help Please! Plotting X,Y,Z 3d surface

From: sumeho

Date: 3 Dec, 2009 00:02:26

Message: 1 of 4

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!

Subject: Help Please! Plotting X,Y,Z 3d surface

From: Sadik

Date: 3 Dec, 2009 01:52:04

Message: 2 of 4

Hi,

Why don't you use plot3? You will do

plot3(x,y,z,'.')

You can see the documentation for further details.

Best.

sumeho <sumeho@gmail.com> wrote in message <6d2b1cd8-5b76-440e-9640-8f9553fa95a9@b15g2000yqd.googlegroups.com>...
> 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!

Subject: Help Please! Plotting X,Y,Z 3d surface

From: TideMan

Date: 3 Dec, 2009 03:19:01

Message: 3 of 4

On Dec 3, 1:02 pm, sumeho <sum...@gmail.com> 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
you.

Subject: Help Please! Plotting X,Y,Z 3d surface

From: Luigi Giaccari

Date: 8 Dec, 2009 12:16:03

Message: 4 of 4

sumeho <sumeho@gmail.com> wrote in message <6d2b1cd8-5b76-440e-9640-8f9553fa95a9@b15g2000yqd.googlegroups.com>...
> 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!

I hope one of these work


http://www.advancedmcode.org/how-to-plot-a-coloured-surface-from-3d-scatter.html

http://www.advancedmcode.org/surface-recostruction-from-scattered-points-cloud-mycrustopen.html

http://www.advancedmcode.org/surface-recostruction-from-scattered-points-cloud-mycrust-robust.html


http://www.advancedmcode.org

If your shape is convex (or can be made convex) use convhulln

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us