Matlab 3D Plot (surf) fills in empty gaps automatically
조회 수: 9 (최근 30일)
이전 댓글 표시
I'm using surf() to plot a portion of a sphere; basically a shell of a certain shape that is on top of a sphere. More specifically, it is the workspace plot of spherical joint with color representing the resolution of the joint at that point.
Anyways, the shape is unique, but surf() automatically fills in gaps that should not be there. I'm guess it might be the order that it is plotted? Is there any way to prevent Matlab from doing this?
I think it is obvious in the pictures what should not be there (the blue portion)...
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152097/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152099/image.jpeg)
Also, it seems to mess up the color coding as well. The dark blue should be at the bottom edges of the shell; instead Matlab assigns it to the surface used to fill the gaps.
Thanks!
댓글 수: 0
답변 (2개)
Walter Roberson
2013년 4월 3일
How are you telling surf() that data should not be there?
The results you are showing are consistent with you having initialized a matrix to 60, writing data into part of it, and then surf()'ing the whole thing.
Omid Adljuy
2013년 4월 5일
Set the Z data that you don't want to be plotted to NaN.
But let the X,Y data remain what they are; I mean don't set X,Y to NaN.
This shall work.
참고 항목
카테고리
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!