我正在尝试编写一个 matlab 脚本,使我能够将颜色渐变添加到我的 3D 绘图中。我正在执行以下测试:
函数句柄 = coloured_line_3d(x, y, z, c)
handle = surface( [x(:), x(:)], [y(:), y(:)],[z(:), z(:)],[c(:), c(:)], 'EdgeColor', 'flat', 'FaceColor', 'none' ); end
x = [1; 2; 3]
y = [1; 2; 3]
z = [1; 2; 3]
c = [1 2 3]
运行它,会出现以下警告:
coloured_line_3d(x,y,z,c)
ans =
0.0029
Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading
Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading
Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading
Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading
我得到一个空的情节。
这有什么问题?