3D Plot with large data

11 views (last 30 days)
stephen
stephen on 15 Feb 2011
Answered: changiz on 27 May 2014
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 Comments
Oleg Komarov
Oleg Komarov on 15 Feb 2011
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 on 27 May 2014
u can use isosurface ,if you matrix name is mat: isosurface(mat);

Sign in to comment.

Answers (3)

Jiro Doke
Jiro Doke on 15 Feb 2011
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 Comment
Walter Roberson
Walter Roberson on 15 Feb 2011
Or gridfit,
http://www.mathworks.com/matlabcentral/fileexchange/8998

Sign in to comment.


Walter Roberson
Walter Roberson on 15 Feb 2011
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 Comments
stephen
stephen on 15 Feb 2011
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 on 15 Feb 2011
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));

Sign in to comment.


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

Tags

Community Treasure Hunt

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

Start Hunting!