作业帮 > 综合 > 作业

matlab 四维图像绘制

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/04/27 06:13:22
matlab 四维图像绘制
就是现在我有一个地区的三维坐标数据,又有在相应坐标处的元素分布数据,怎样画一个三维图像用颜色表示元素分布的图像呢?求代码,
请使用matlab作图,抱歉啊,我没有金币了,没法追问了,现在还是存在问题,就是Error in ==> picutre at 18
zi=griddata(x,y,z,xi,yi','v4');
help surf
SURF 3-D colored surface.
SURF(X,Y,Z,C) plots the colored parametric surface defined by
four matrix arguments. The view point is specified by VIEW.
The axis labels are determined by the range of X, Y and Z,
or by the current setting of AXIS. The color scaling is determined
by the range of C, or by the current setting of CAXIS. The scaled
color values are used as indices into the current COLORMAP.
The shading model is set by SHADING.
再问: 可是C的颜色怎么根据我需要的元素分布数据来选色呢?
再答: C直接用你元素分布的数据就行,然后通过改colormap指定每个数据对应什么颜色
再问: 怎么改呢,求代码。因为数据量很大,不太好弄啊
再答: 你先直接用SURF(X,Y,Z,C)把图画出来,如果觉得颜色不好看,开colormapeditor,这个是所见即所得的
再问: A=load('data.txt'); x=A(:,1); y=A(:,2); z=A(:,3); c=load('cdata.txt'); xi=0:1:29000; yi=0:1:19000; zi=griddata(x,y,z,xi,yi,'v4') scatter3(x,y,z);%散点图 figure surf(xi,yi,zi)%,shading interp%三维曲面 colorbar 帮忙改下把,谢谢啊
再答: c的size跟z一样吗? 是的话 A=load('data.txt'); x=A(:,1); y=A(:,2); z=A(:,3); c=load('cdata.txt'); xi=0:1:29000; yi=0:1:19000; zi=griddata(x,y,z,xi,yi,'v4') ci=griddata(x,y,c,xi,yi,'v4') scatter3(x,y,z);%散点图 figure surf(xi,yi,zi,ci)%,shading interp%三维曲面 colorbar