- Community Home
- :
- Discussion Forums
- :
- Most Active Software Boards
- :
- LabVIEW
- :
- How to plot 3D surface graph from X,Y,Z points?

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

How to plot 3D surface graph from X,Y,Z points?

07-24-2010 04:57 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi all,

Need to plot a 3D surface from X,Y,Z 1D arrays. This works when plotting as points but I want to form surfaces between the points.

I am thoroughly confused about the formation of the 2D Z matrix required by 3D plot surface helper. How to form the Z array (2D)?

Attached is a VI with typical (default) data.

Thanks to all.

Battler.

Re: How to plot 3D surface graph from X,Y,Z points?

07-24-2010 10:32 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Re: How to plot 3D surface graph from X,Y,Z points?

07-24-2010 11:09 AM - edited 07-24-2010 11:13 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Here's a screenshot of the VI: for licensing reasons I cannot upload a working version of the code. It should be easy enough to reconstruct. The 3D polynomial fit and evaluation VI's (the ugly subVIs with black text on white) can be downloaded from this link: http://zone.ni.com/devzone/cda/epd/p/id/470

Also, consider searching through altenbach's posts for '3D'. He has provided excellent information on different 3D interpolation methods, and if I recall has even uploaded a library of his own interpolation functions.

***EDIT: Wait a little longer... thinking about this again... ***

Re: How to plot 3D surface graph from X,Y,Z points?

07-24-2010 11:28 AM - edited 07-24-2010 11:31 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Re: How to plot 3D surface graph from X,Y,Z points?

07-24-2010 11:34 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Re: How to plot 3D surface graph from X,Y,Z points?

07-24-2010 02:02 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

If you have mathscript, you can use the griddata function.

Re: How to plot 3D surface graph from X,Y,Z points?

07-24-2010 02:28 PM - edited 07-24-2010 02:29 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Looking at your data, it is well quantized to a grid if integers with a spacing of 1 and perfectly arranged in the 1D arrays.

In this particular case, you can do as follows:

If the x and y ramps have noninteger increments, you need to remap a little bit.

Re: How to plot 3D surface graph from X,Y,Z points?

02-03-2012 07:16 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi,

I tried to generate a 3D plot using the method described here, but I am running into to some problem with the plotting. You can see from my code (file "surface plot" and sample data) attached that I get an unexpected plane connecting the start and end points on the surface plot. Ideally, only the curved surface should be present. It would be great if any of you have any clue. Please let me know if you need more information. Thanks for the help in advance.

Re: How to plot 3D surface graph from X,Y,Z points?

02-03-2012 07:18 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Here're additional files you'll need.

Re: How to plot 3D surface graph from X,Y,Z points?

02-04-2012 03:22 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@User89 wrote:

I tried to generate a 3D plot using the method described here,

No, you are not! Your X axis values are a sawtooth instead of a linear ramp. There are two ways to graph a 3D surface. In your case, your z data is a 2D array, thus your x and y arrays need to correspond to the linear ramps in the x and y direction. Disconnect the x and y vector temporarily to see the real 2D data.

(You also have horrible race conditions, for example in "Table Gen.vi" you are writing to and reading from a global variable and there is no telling what happens first, but the outcome critically depends on it.)