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 with isosurface function

Subject: help with isosurface function

From: J G

Date: 24 Aug, 2011 01:54:25

Message: 1 of 3

Hi, I'm fairly new to matlab and need some help using the isosurface function. I have a matrix of n rows and 3 columns. I had previously tried scatter3 but this doesn't show the density very well. The isosurface function might work, however can somebody show a simple example using n x 3 data? Thanks.

Subject: help with isosurface function

From: vedenev

Date: 24 Aug, 2011 04:57:10

Message: 2 of 3

Your data is point cloud, your need to convert it to volume data that
requared for issosurface. Here example of convert with nearest point
in for loop:

n=1000;

x=rand(1,n);
y=rand(1,n);
z=rand(1,n);
v=5*rand(1,n);
%scatter3(x,y,z,v);

% mesh:
xx=0:0.2:1;
yy=0:0.2:1;
zz=0:0.2:1;
[X,Y,Z] = meshgrid(xx,yy,zz);

% use closest point:
V=zeros(size(X));
for nc=1:n
    d2=(X-x(nc)).^2+...
    (Y-y(nc)).^2+...
    (Z-z(nc)).^2;
    [tmp ind]=min(d2(:));
    V(ind)=v(nc);
end

isosurface(X,Y,Z,V,2);


-----------------------------------------
Maxim Vedenev, MATLAB Custom Programming
vedenev@ngs.ru
http://simulations.narod.ru/

Subject: help with isosurface function

From: J G

Date: 29 Aug, 2011 04:30:28

Message: 3 of 3

vedenev <vedenev.maxim@gmail.com> wrote in message <db8acbe1-6a20-484e-a1fa-d76816dfb40c@y24g2000yqb.googlegroups.com>...
> Your data is point cloud, your need to convert it to volume data that
> requared for issosurface. Here example of convert with nearest point
> in for loop:
>
> n=1000;
>
> x=rand(1,n);
> y=rand(1,n);
> z=rand(1,n);
> v=5*rand(1,n);
> %scatter3(x,y,z,v);
>
> % mesh:
> xx=0:0.2:1;
> yy=0:0.2:1;
> zz=0:0.2:1;
> [X,Y,Z] = meshgrid(xx,yy,zz);
>
> % use closest point:
> V=zeros(size(X));
> for nc=1:n
> d2=(X-x(nc)).^2+...
> (Y-y(nc)).^2+...
> (Z-z(nc)).^2;
> [tmp ind]=min(d2(:));
> V(ind)=v(nc);
> end
>
> isosurface(X,Y,Z,V,2);
>
>
> -----------------------------------------
> Maxim Vedenev, MATLAB Custom Programming
> vedenev@ngs.ru
> http://simulations.narod.ru/




Thanks very much for your reply.
Sorry I'm not quite sure I follow it exactly, what is v?
You define it as:
v=5*rand(1,n);
%scatter3(x,y,z,v);
but I don't know how to relate that to my data.
Thank again.

Tags for this Thread

No tags are associated with 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