Thanks
Sean
Can your brain see this graph? If you can't visualize your graph, it
probably means it can't be done, in or out of Matlab...
If you know what your graph should look like, maybe more details would
be helpful. Is you z really helpful?
Guillaume
Ross
The approaches I'd use here would be either to:
1. Plot an iso-surface. (Think of this as a 3d
contour plot.)
2. Display patches for the entire volume, where
intensity is used to control the transparancy of
each patch.
Multiple variables can be dealt with using color,
as long as you have no more than 3 outputs.
You may need to use griddatan to interpolate
everything onto a lattice in the 3d space.
HTH,
John D'Errico
--
There are no questions "?" about my real address.
The best material model of a cat is another, or
preferably the same, cat.
A. Rosenblueth, Philosophy of Science, 1945
Absolutely you can. 4D plots are a very useful things, but it is not
very easy to produce them in Matlab. If the x-y-z data are ordered as
explained in:
http://www.mathworks.com/access/helpdesk/help/techdoc/visualize/chpatch5.shtml
you can easily create 4D plots by filling x-y-z patches with 4th
dimension data. For example:
patch(x,y,z,colors);
will plot the 3D x-y-z grid in which every patch (pseudo-cube cell) is
filled by the color specified in colors. For my applications I had to
do this, and it was fairly complicated to understand (from TMW
manuals) how to organize the x-y-z data to create pseudo-cubix cells.
As example, I had a grid composed by 50820 cells; every cell has 8
corners (24 coordinates), but the software that produced this "grid"
has a different ordering convention wrt Matlab. So this is what I've
done to produce a filled grid in 4D:
% coords is a matrix of size 24x50820
x1 = coords(1:3:end,:);
y1 = coords(2:3:end,:);
z1 = coords(3:3:end,:);
dimensprod = 50820;
xa = zeros(24,dimensprod);
ya = zeros(24,dimensprod);
za = zeros(24,dimensprod);
% Adjust ECLIPSE - Matlab Ordering: X-Direction
xa([1,14,17],:) = repmat(x1(5,:),3,1);
xa([2,5,18],:) = repmat(x1(6,:),3,1);
xa([6,9,19],:) = repmat(x1(8,:),3,1);
xa([10,13,20],:) = repmat(x1(7,:),3,1);
xa([4,15,21],:) = repmat(x1(1,:),3,1);
xa([3,8,22],:) = repmat(x1(2,:),3,1);
xa([11,16,24],:) = repmat(x1(3,:),3,1);
xa([7,12,23],:) = repmat(x1(4,:),3,1);
% Adjust ECLIPSE - Matlab Ordering: Y-Direction
ya([1,14,17],:) = repmat(y1(5,:),3,1);
ya([2,5,18],:) = repmat(y1(6,:),3,1);
ya([6,9,19],:) = repmat(y1(8,:),3,1);
ya([10,13,20],:) = repmat(y1(7,:),3,1);
ya([4,15,21],:) = repmat(y1(1,:),3,1);
ya([3,8,22],:) = repmat(y1(2,:),3,1);
ya([11,16,24],:) = repmat(y1(3,:),3,1);
ya([7,12,23],:) = repmat(y1(4,:),3,1);
% Adjust ECLIPSE - Matlab Ordering: Z-Direction
za([1,14,17],:) = repmat(z1(5,:),3,1);
za([2,5,18],:) = repmat(z1(6,:),3,1);
za([6,9,19],:) = repmat(z1(8,:),3,1);
za([10,13,20],:) = repmat(z1(7,:),3,1);
za([4,15,21],:) = repmat(z1(1,:),3,1);
za([3,8,22],:) = repmat(z1(2,:),3,1);
za([11,16,24],:) = repmat(z1(3,:),3,1);
za([7,12,23],:) = repmat(z1(4,:),3,1);
% Create Patch Faces
xb = reshape(xa,4,6*dimensprod);
yb = reshape(ya,4,6*dimensprod);
zb = reshape(za,4,6*dimensprod);
% Create Faces Colors Based On Cell Porosity
colors = repmat(porosity,1,6)';
colors = colors(:);
% Launch 4D visualizer
figs = figure;
set(figs,'renderer','opengl','backingstore','off');
set(gca,'zdir','reverse','ydir','reverse','drawmode','fast');
% Create Patches
h1 = patch(xb,yb,zb,colors);
set(h1,'edgecolor','w');
% xlabel('X
Coordinates','Color','w','Fontsize',10,'Fontweight','bold');
% ylabel('Y
Coordinates','Color','w','Fontsize',10,'Fontweight','bold');
% zlabel('Z
Coordinates','Color','w','Fontsize',10,'Fontweight','bold');
% grid on
view(3);
axis equal
axis vis3d
axis tight
But even with the OpenGL options, backingstore=off and drawmode=fast,
it is very slow process to visualize the whole grid filled (not
talking about rotating, zooming and so on...). I have a very powerful
PC, and the figure creation process is slow as a turtle. I cannot
imagine on other computers when I will compile my program into an
executable... Compared to other visualization software for 3D-4D
imaging, I was expecting something faster. Perhaps I'm missing
something, but when someone asks for "fast drawing in Matlab", there
are no solutions that can be applied to really have "fast" drawings...
HTH
Andrea.
matrix X contains X coordinates
eg. X(m,n,depth) ....depth contain the number of depth planes.
matrix Y contains Y coordinates
eg. Y(m,n,depth)
matrix Z contains the distance of the depth plane from a reference
point.
eg ..Z(m,n,depth).....if in the first depth plane...the Z value is
2.1.....then the 2D Z is 2.1 2.1 2.1
2.1 2.1 2.1
2.1 2.1 2.1
for the next depth plane..the value may be 5.7 5.7 5.7
5.7 5.7 5.7
5.7 5.7 5.7
All coordinates are unevenly spaced.
The intensity value is the same for all depth planes..eg I(m,n,depth)
for an element.
How do i plot this?
Further more.....this four 3D matrix data correspond to one element
of data. I have 5 other elements of four 3D data to be combined. some
of the coordinates of each element may be the same or close to other
element's coordinates. Intensity value for different elements are not
the same.
The coordinates which are the same or very close to each other for all
element data is my solution of coordinates.
How to represent this in Matlab??
try this
% <<< CODE BEG >>>
% get the data
a=[ 134.341 283.951 339.0 1.0
114.979 293.947 313.0 1.0
96.634 316.549 287.0 4.0
79.374 350.242 261.0 3.0
60.684 362.861 301.0 4.0
43.113 367.384 23.0 2.0];
x=d(:,1);
y=d(:,2);
z=d(:,3);
c=d(:,4);
% create a <stem> plot
h=stem3(x,y,z);
set(h(1),'color',[0 0 0]);
delete(h(2));
% color stem tops appropriately
cs=25;
cm=jet(cs*5);
for i=1:length(c)
line(x(i),y(i),z(i),...
'marker','.',...
'markersize',40,...
'color',cm(cs*c(i),:));
end
% create a suitable <colorbar>
colormap(cm);
ch=colorbar;
set(ch,'ytick',cs*[1:5]);
set(ch,'yticklabel',[1:5]);
set(get(ch,'ylabel'),'string','result');
% <<< CODE END >>>
Not sure how u ll combine it with other sets of ur data though.
THT
kapil