【发布时间】:2016-08-17 08:30:51
【问题描述】:
我在 Mathematica 中用数值计算了感兴趣的函数 $f(x,y)$。为了一致性,我想使用 Matlab 进行绘图。
我以矩阵形式导出了我的函数:
test =
-1.0000 -1.0000 -0.4864
-1.0000 -0.6000 -0.2804
-1.0000 -0.2000 -0.0462
-1.0000 0.2000 -0.0462
-1.0000 0.6000 -0.2804
-1.0000 1.0000 -0.4864
-0.6000 -1.0000 -0.2997
-0.6000 -0.6000 -0.1526
-0.6000 -0.2000 0.1118
-0.6000 0.2000 0.1118
-0.6000 0.6000 -0.1526
-0.6000 1.0000 -0.2997
-0.2000 -1.0000 -0.1809
-0.2000 -0.6000 -0.0939
-0.2000 -0.2000 -0.0046
-0.2000 0.2000 -0.0046
-0.2000 0.6000 -0.0939
-0.2000 1.0000 -0.1809
0.2000 -1.0000 -0.1809
0.2000 -0.6000 -0.0939
0.2000 -0.2000 -0.0046
0.2000 0.2000 -0.0046
0.2000 0.6000 -0.0939
0.2000 1.0000 -0.1809
0.6000 -1.0000 -0.2997
0.6000 -0.6000 -0.1526
0.6000 -0.2000 0.1118
0.6000 0.2000 0.1118
0.6000 0.6000 -0.1526
0.6000 1.0000 -0.2997
1.0000 -1.0000 -0.4864
1.0000 -0.6000 -0.2804
1.0000 -0.2000 -0.0462
1.0000 0.2000 -0.0462
1.0000 0.6000 -0.2804
1.0000 1.0000 -0.4864
所以test 是 36x3 矩阵,其中列是 x、y 和 f(x,y)。现在我需要绘制等高线图。
但是,它不是meshgrid的形式。有什么想法,如何快速将其转换为contour 函数可以绘制的形式?
【问题讨论】:
-
为什么需要
meshgrid形式的?为什么不直接做contour(f)? -
它会产生非常奇怪的结果。我确定这是不正确的,因为我在 Mathematica 中绘制了它
-
将其绘制为
y,x,f(x,y)? -
你能详细解释一下吗
-
contour(test(:,2),test(:,1),test(:,3))?
标签: matlab plot wolfram-mathematica