Gnuplot - 3d 图上的矢量

Gnuplot - Vectors on 3d plot

我想在已经创建的图上显示优化函数的向量。

我的代码:

set xrange[1:4]
set yrange[2:5]
set zrange[2:6]

splot x+y-4, x+1-y, y-1-x, 10-x-y

梯度(向量)为[2,3,1]、[1,-1,1]。

非常感谢您的帮助。 (如果你能创建一个线性函数,我也会很高兴:))

如果要将矢量作为箭头包含在内,可以使用工具 set arrow。对于您提供的两个向量:

set arrow 1 from 0,0,0 to 2,3,1
set arrow 2 from 0,0,0 to 1,-1,1

当然,您可以根据需要应用任何 arrowstyle 来更改外观。