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:
Building a 3D surface by giving coordinates (in a struct)

Subject: Building a 3D surface by giving coordinates (in a struct)

From: Daniel Drori

Date: 23 Jan, 2009 06:55:04

Message: 1 of 7

Hey there!!

I'm trying to build a 3D surface.
I used a struct to build my data-base witch includes 3 fields "x", "y", "z".
Now, after my bata base is built and ready and have all the coordinates I collected, I want, simply, to show all the 3-coordinates-points and connect them with a curvey surface.

Can anyone please help me out with it?
1) How to release the coordinates from the struct?
2) How to use those coordinates for building the surface?

Thanx alot,
Daniel.

Subject: Building a 3D surface by giving coordinates (in a struct)

From: Daniel Drori

Date: 23 Jan, 2009 09:12:02

Message: 2 of 7

"Daniel Drori" <dandul_d@yahoo.com> wrote in message <glbpk8$ig7$1@fred.mathworks.com>...
> Hey there!!
>
> I'm trying to build a 3D surface.
> I used a struct to build my data-base witch includes 3 fields "x", "y", "z".
> Now, after my bata base is built and ready and have all the coordinates I collected, I want, simply, to show all the 3-coordinates-points and connect them with a curvey surface.
>
> Can anyone please help me out with it?
> 1) How to release the coordinates from the struct?
> 2) How to use those coordinates for building the surface?
>
> Thanx alot,
> Daniel.

Please help...

Subject: Building a 3D surface by giving coordinates (in a struct)

From: David Doria

Date: 30 Jan, 2009 17:05:04

Message: 3 of 7

[X,Y] = meshgrid(x,y);
Z = griddata(x,y,z, X, Y);
figure;
surf(X,Y,Z);

Who knows why they don't provide a function to do this...?

Hope that helps!
Dave

Subject: Building a 3D surface by giving coordinates (in a struct)

From: us

Date: 30 Jan, 2009 18:26:01

Message: 4 of 7

"David Doria"
> [X,Y] = meshgrid(x,y);
> Z = griddata(x,y,z, X, Y);
> figure;
> surf(X,Y,Z);
> Who knows why they don't provide a function to do this...

simply to give CSSMers something to do for the rest of their lives...

:-)
us

Subject: Building a 3D surface by giving coordinates (in a struct)

From: Daniel Drori

Date: 4 Feb, 2009 21:47:01

Message: 5 of 7

"us " <us@neurol.unizh.ch> wrote in message <glvgnp$3h0$1@fred.mathworks.com>...
> "David Doria"
> > [X,Y] = meshgrid(x,y);
> > Z = griddata(x,y,z, X, Y);
> > figure;
> > surf(X,Y,Z);
> > Who knows why they don't provide a function to do this...
>
> simply to give CSSMers something to do for the rest of their lives...
>
> :-)
> us


Hey there!!

I'm trying to build a 3d surface from several samples of x,y,z that i took from the original picture. the x,y are presnting the position by pixels, and the 'z' is the distance from the camera to that spot.

I'm reading the data from a file into 3 vectors (x,y,z) and trying to build 3 matrices (XI,YI,ZI) with the code I use bellow:

tx = 1:1:PicSize(1);
ty = 1:1:PicSize(2);

[XI,YI] = meshgrid(tx,ty);
ZI = griddata(x,y,z,XI,YI,'cubic');

surf(XI,YI,ZI);
mesh(XI,YI,ZI), hold on;
plot3(x,y,z,'o'), hold off

As output I get a graph, but that graph is not similar at all to the picture that I took the samples from. The data that I use is fully correct.

The pixels' position (x,y) that I get from the picture is after using the method in matlab:
datacursormode on
I think this function might gives me wrong data, because the 0,0 position starts from the upper left corner and not from the bottom as I thought it should be.
When I show the graph using surf(XI,YI,ZI); the 0,0 position is at the bottom.

Dose anyone know how can I solve this problem?

Thanks in advance.
Daniel Drori.

Subject: Building a 3D surface by giving coordinates (in a struct)

From: Luis FIlipe Ferreira Marques Santos

Date: 29 Aug, 2011 10:50:26

Message: 6 of 7

"David Doria" <daviddoria@gmail.com> wrote in message <glvc00$f47$1@fred.mathworks.com>...
> [X,Y] = meshgrid(x,y);
> Z = griddata(x,y,z, X, Y);
> figure;
> surf(X,Y,Z);
>
> Who knows why they don't provide a function to do this...?
>
> Hope that helps!
> Dave

Hi Dave, I'm trying to build something like Daniel.
I'm loading my data from a txt and up ti this point is working just fine.

The problem is because its a lot of triplets (3 coordinates), around 4 millions points, and I get this ERROR from MATLAB.
"??? Maximum variable size allowed by the program is exceeded."

I think its because of the size, but there is another way to surface all the 4 millions points?
I need all the data at same time, and cannot cut it to see it by smaller regions.

If you can give some orientation, I would be very thankful.

Best Regards

Luis

Subject: Building a 3D surface by giving coordinates (in a struct)

From: ranashree das

Date: 6 May, 2014 11:09:13

Message: 7 of 7

"Daniel Drori" <dandul_d@yahoo.com> wrote in message <glc1l2$ioi$1@fred.mathworks.com>...
> "Daniel Drori" <dandul_d@yahoo.com> wrote in message <glbpk8$ig7$1@fred.mathworks.com>...
> > Hey there!!
> >
> > I'm trying to build a 3D surface.
> > I used a struct to build my data-base witch includes 3 fields "x", "y", "z".
> > Now, after my bata base is built and ready and have all the coordinates I collected, I want, simply, to show all the 3-coordinates-points and connect them with a curvey surface.
> >
> > Can anyone please help me out with it?
> > 1) How to release the coordinates from the struct?
> > 2) How to use those coordinates for building the surface?
> >
> > Thanx alot,
> > Daniel.
>
> Please help...

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