3D Plot with large data
조회 수: 11 (최근 30일)
이전 댓글 표시
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
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...
답변 (3개)
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
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
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));
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!