我正在尝试做一个与所附的类似的图。
我正好有一个包含日期(x 轴)的 (224x1) 向量、一个包含到期日(y 轴)的 (10x1) 向量和一个包含值(z 轴)的 (224x10) 矩阵。
我尝试了 surf(X, Y, Z) 但出现错误(“数据维度必须一致”)。
我怎样才能将其结合起来制作一个像所附的那样的情节?
谢谢,V!
编辑:第二个情节是我使用路易斯·门多的建议得到的情节:
最佳答案
使用
surf(Y,X,Z)
来自documentation (强调):
surf(x,y,Z)
andsurf(x,y,Z,C)
, with two vector arguments replacing the first two matrix arguments, must havelength(x) = n
andlength(y) = m
where[m,n] = size(Z)
. In this case, the vertices of the surface patches are the triples (x(j), y(i), Z(i,j)). Note thatx
corresponds to the columns ofZ
andy
corresponds to the rows.
关于matlab - matlab 三维绘图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29903263/