【问题标题】:how to get the correct surface plot with matlab?如何用matlab得到正确的曲面图?
【发布时间】:2013-12-01 11:29:34
【问题描述】:

我想绘制三个东西,alpha、temp 和 Ea。它们都具有相同的长度,即 81 这是我用于此的代码。

clear all
clc
alp=[xlsread('3ddata.xlsx','Sheet1','A:A')]
temp=[xlsread('3ddata.xlsx','Sheet1','B:B')];
Ea=[xlsread('3ddata.xlsx','Sheet1','C:C')];
surf([alp, temp,Ea])
axis tight
xlabel 'Alpha'
ylabel 'temp'
zlabel 'Ea'

当我得到图时,x 轴标记为从 1 到 3,而实际上它是从 0.1 到 0.9(数据),类似地,y 轴在图表上显示为 1 到 80,而实际上它是从 374到 394 并且与 z 轴 (Ea) 相同,它在图上显示从 -600 到 200,而实际上它是从 -619 到 -591 .. (alpha 从 0.1 到 0.9,温度从 374 到 394,Ea 从 - 619 到 -591)

图表附在此处 http://s27.postimg.org/eiv71pftf/myplot.jpg

【问题讨论】:

标签: matlab plot matlab-figure figure


【解决方案1】:

您使用surf 的方式并没有真正的意义。使用一个输入参数,整个矩阵就是一个高度图。没有你的数据,我只能猜测:试试plot3(alp, temp,Ea)。这是否提供了正确的输出,只是缺少了两者之间的表面?

你也可以试试:

tri = delaunay(alp,temp);
trisurf(tri,alp,temp,Ea)

你能提供输入数据吗?

【讨论】:

  • Thanks alot The input data is the following alp Temp Ea 0.1 391.58 -618.689 0.2 390.802 -514.175 0.3 389.908 -440.807 0.4 388.939 -389.19 0.5 387.836 -351.683 0.6 386.432 -329.766 0.7 384.461 -334.504 0.8 381.028 - 382.355 0.9 374.102 -594.966 我应该把 excel 文件或屏幕截图发给你。
  • s24.postimg.org/4tsy8ahk5/sample.png 这是我想要得到的样本图,这是我的输入数据pastebin.com/TySjCwuc
  • 您的数据描述了 3D 空间中的一条线,但只是一个表面。
【解决方案2】:

如果您想将Ea(z 轴)绘制为alp(x 轴)和temp(y 轴)的函数,请尝试

surf(alp, temp, Ea)

为此,尺寸必须类似于:alp 81 x 1; temp 81 x 1; Ea 81 x 81(给出alp 和temp 的每个组合的值)。

【讨论】:

  • 我怀疑[xlsread('3ddata.xlsx','Sheet1','C:C')] 返回一个矩阵。
  • @DanielR 你是对的。如果它们都是向量,plot3 可能是要走的路。
  • @LuisMendo 当我使用 surf(alp,temp,Ea) 时出现以下错误 Error using surf (line 75) Z must be a matrix, not a scalar or vector.
  • s24.postimg.org/4tsy8ahk5/sample.png 这是我想要得到的样本图,这是我的输入数据pastebin.com/TySjCwuc
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多