How to create discontinuous surfaces?
조회 수: 12 (최근 30일)
이전 댓글 표시
I am using the surf fucntion with an array that I have populated with heights for the surface. When the height in the array is zero I want the surface not to be drawn there instead of the surface being filled in at the 0 height.
댓글 수: 0
답변 (1개)
Jaswanth
2024년 10월 25일 10:01
Hi,
To create discontinuities in your surface plot using the ‘surf’ function, you can replace height values of ‘zero’ with ‘NaN’. This will prevent the surface from being drawn at those points, resulting in the desired gaps.
Assuming ‘z’ is your data array for heights, you can use the following line to introduce discontinuities:
% Replace zero values with NaN to create discontinuities
z(z == 0) = NaN;
I hope this is helpful!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!