Why do I get an error trying to slice a 3D?

2 ビュー (過去 30 日間)
Kabo
Kabo 2023 年 9 月 15 日
コメント済み: Walter Roberson 2023 年 9 月 15 日
Error using matlab.graphics.chart.primitive.Surface
Error setting property 'CData' of class 'Surface':
Value must be a 2D or 3D array of numeric type.
clc
x = linspace(0, 3, Nx*3);
y = linspace(0, 1, Ny*1);
z = linspace(0, 1, Nz*1);
[X, Y, Z] = meshgrid(x, y, z);
EQ_gy = cos(2*pi*X).*sin(2*pi*Y) + cos(2*pi*Y).*sin(2*pi*Z) + cos(2*pi*Z).*sin(2*pi*X);
[y,z] = meshgrid(linspace(0,1,20));
for off=0.5:0.5:2.5
x = off + zeros(size(z));
surf(x,y,z,EQ_gy)
hold on
end
hold off
xlim([0 2.5])

回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 9 月 15 日
you cannot use surf to display solid volumes. See volshow
  1 件のコメント
Walter Roberson
Walter Roberson 2023 年 9 月 15 日
If you have three independent input variables and one dependent output variable, then you should consider: slice or isosurface or volshow or volumeviewer

サインインしてコメントする。

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by