matlab图中颜色的渐变

时间:2013-09-26 23:57:27

标签: matlab

我正在尝试编写一个matlab脚本,它可以让我在我的3D绘图中添加颜色渐变。我正在进行以下测试:

  

function handle = 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 

我得到一个空的情节。

这有什么问题?

0 个答案:

没有答案