在没有等距点的三个向量上使用 matlab 的 surf 函数

use matlab's surf function on three vectors without equidistant points

I 运行 曲面 z 上的优化函数,由两个参数 (xy) 定义。对于每次迭代,我以向量形式存储 x,y,z 值。 我想使用 matlab 的 surf 函数绘制 z,但这要求 z 是大小为 (length(x), length(y)) 的矩阵。

我找到了一些使用 meshgrid 执行此操作的方法,但这需要我在 xy 中的点均匀分布。因为它们是我的优化过程的结果(在步长中有一些 运行domness 退火),所以 xy 中的点不是等距的。
有什么好的方法可以把我的 z 向量变成对应的矩阵吗?

看起来你在追求 griddata:

The griddata function interpolates the surface at the query points specified by (xq,yq) and returns the interpolated values, vq. The surface always passes through the data points defined by x and y.