3D Plot with large data

12 次查看(过去 30 天)
stephen
stephen 2011-2-15
回答: changiz 2014-5-27
Hi, I have a question regarding doing a 3D plot.
I have a 500,000x3 matrix (column A, B, C). Now I want to do a 3D plot by showing A in x-axis and B in y-axis and C in z-axis. I know I could probably use funtion "mesh" to do the plot. But to use the mesh function, I have to use meshgrid function to transform the vectors into matrices. The problem is that since each variable has 500,000 rows, I got an error message "Maximum variable size allowed by the program is exceeded." Anyone has a solution to it or other ways of doing the 3D plot?
Thanks for your help!
Stephen
  2 个评论
Oleg Komarov
Oleg Komarov 2011-2-15
Don't recall the post, but you won't need all of the points especially since the amount of pixels on the screen are less...
changiz
changiz 2014-5-27
u can use isosurface ,if you matrix name is mat: isosurface(mat);

请先登录,再进行评论。

回答(3 个)

Jiro Doke
Jiro Doke 2011-2-15
Another thing you could try is to do some interpolation of the data and plot at a lower resolution. As Oleg points out, there's no sense in trying to visualize 500000 points at once. Check out triscatteredinterpclass (or griddata).
F = TriScatteredInterp(M(:,1), M(:,2), M(:,3));
[qx, qy] = meshgrid(linspace(min(M(:,1)), max(M(:,1)), 20), ...
linspace(min(M(:,2)), max(M(:,2)), 20));
qz = F(qx, qy);
mesh(qx, qy, qz);
  1 个评论
Walter Roberson
Walter Roberson 2011-2-15
Or gridfit,
http://www.mathworks.com/matlabcentral/fileexchange/8998

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2011-2-15
You have not really defined what you want your plot to look like or whether the points are expected to have relationships to adjacent points.
plot3(M(:,1), M(:,2), M(:,3))
scatter3(M(:,1), M(:,2), M(:,3))
  2 个评论
stephen
stephen 2011-2-15
Thanks for your quick response, Walter.
Each pair of A and B decides an unique value of C. The plot would like a curved surface. I tried plot3 but looks like the screen froze for a little while then crashed. I guess it was because the data is too big.
Walter Roberson
Walter Roberson 2011-2-15
Sounds like you don't have any structuring of the points. In that case, scatter3() would be better. You could start off with a random sampling of points to see how it goes:
numsamps = 1000;
idx = 1 + floor(size(M,2) * rand(numsamps,1));
scatter3(M(idx,1), M(idx,2), M(idx,3));

请先登录,再进行评论。


changiz
changiz 2014-5-27
u can use isosurface ,if you matrix name is mat: isosurface(mat);

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by