plot 3D grid using mesh() with lack of individual data
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi, I want to use mesh to plot 3D grids with the format of mesh(x, y, z). My z is a 47*11 matrix, in which the 7 column actually has only 45 values, and I set the other 2 numbers as NaN in order to from a matrix with other columns. But when I plot the figure, the location of NaN is blank (see below).
Is there any method to fill these special locations? Thanks!
댓글 수: 0
채택된 답변
Star Strider
2021년 10월 7일
It would be best to have your data, however an illustration of the procedure using the fillmissing function is — .
x = 1:11;
y = 1:47;
z = y(:)*x
figure
mesh(x, y, z)
grid on
title('Original')
z(20:25,5:7) = NaN; % Create Gaps
figure
mesh(x, y, z)
grid on
title('With Gaps')
z = fillmissing(z, 'linear');
figure
mesh(x, y, z)
grid on
title('Interpolated')
.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!