You can convert your data into a mesh grid using scattered data
interpolation.
If you have release R2009a or later
help TriScatteredInterp
otherwise
help griddata3
Here's an example using TriScatteredInterp.
% I will create sample data (x,y,z,v)
x = 2*rand(5000,1)-1;
y = 2*rand(5000,1)-1;
z = 2*rand(5000,1)-1;
v = x.^2 + y.^2 + z.^2;
% Construct an interpolant from the sample data
F = TriScatteredInterp(x,y,z,v)
% Create a mesh grid and query the interpolant at those points
d = -0.8:0.05:0.8;
[xi,yi,zi] = meshgrid(d,d,d);
vi = F(xi,yi,zi);
You now have a regular grid defined by (xi,yi,zi,vi) which you can slice.
Best regards,
Damian
"sharmin shamsalsadati" <sharmin_sh...@yahoo.com> wrote in message
news:hd9iks$knj$1...@fred.mathworks.com...
"sharmin shamsalsadati" <sharmin_sh...@yahoo.com> wrote in message <hd9iks$knj$1...@fred.mathworks.com>...
Unless I am missing something, I believe you are contradicting yourself. If
you say that c(i) is the intensity at x(i), y(i), z(i) then the intensity IS
a function of the coordinates.
In my example v(i) is the "value" at x(i), y(i), z(i) , same thing!
Regards,
Damian
"sharmin " <damian...@mathworks.com> wrote in message
news:hd9qe6$29c$1...@fred.mathworks.com...
% t is the input file (214273 by 5)
for k=1:97
for j=1:47
for i=1:47
x(k,j,i)=t(p,3);
y(k,j,i)=t(p,4);
z(k,j,i)=t(p,5);
v(k,j,i)=t(p,1);
p=p+1;
end
end
end
[X,Z,Y]=meshgrid(-705:10:675,-1455:10:475,-705:10:675);
V=griddata3(x,z,y,v,X,Z,Y);
slice(X,Z,Y,V,-5,[],[]);
I appreciate your help.
"Damian Sheehy" <Damian...@mathworks.com> wrote in message <hd9o1j$1cf$1...@fred.mathworks.com>...
Sharmin,
That can mean one of two things;
(1) The intensity does not vary in the slice plane or
(2) If you expect the slice plane to show varying intensities, then you have
made a mistake somewhare
Your approach looks reasonable to me (Though I suspect you may be able make
your code run more efficiently by eliminating the three for loops and
vectorizing your code).
Why don't you try verifying your code using data sampled from an analyic
function.
For example, creste a test case like this for your code. That may pointpoint
where the problem is;
x = -2 + 4.*rand(10000,1);
y = -2 + 4.*rand(10000,1);
z = -2 + 4.*rand(10000,1);
v = x .* exp(-x.^2 - y.^2 - z.^2);
[xi,yi,zi] = meshgrid(-2:.2:2, -2:.25:2, -2:.16:2);
vi = griddata3(x,y,z,v,xi,yi,zi);
slice(xi,yi,zi,vi,[-1.2 .8 2],2,[-2 -.2])
Damian
I hope one of these work
Building the surface
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/how-to-plot-a-coloured-surface-from-3d-scatter.html
( this one shows how to colour it)