matlab如何画四维图像。
〈本帖收录于〉——〖素质文库〗
(三大专题:〖Only one〗、〖On Spss〗、〖On Matlab〗)
法一
这个问题相当于有限元里面后处理的例子。一个数组一共四列,前三列为坐标xyz,第四列为温度。
- clear
- clc
- data=load('c:/nodetemp.txt')
- sx=0:0.2/5:0.2
- sy=0:0.3/5:0.3
- sz=0:0.2/5:0.2
- v=zeros(6,6,6)
- for index=1:216
- if (data(index,1)-0.00)<1e-5
- xbiao=1
- elseif (data(index,1)-0.04)<1e-5
- xbiao=2
- elseif (data(index,1)-0.08)<1e-5
- xbiao=3
- elseif (data(index,1)-0.12)<1e-5
- xbiao=4
- elseif (data(index,1)-0.16)<1e-5
- xbiao=5
- elseif (data(index,1)-0.2)<1e-5
- xbiao=6
- end
-
- if (data(index,2)-0.00)<1e-5
- ybiao=1
- elseif (data(index,2)-0.06)<1e-5
- ybiao=2
- elseif (data(index,2)-0.12)<1e-5
- ybiao=3
- elseif (data(index,2)-0.18)<1e-5
- ybiao=4
- elseif (data(index,2)-0.24)<1e-5
- ybiao=5
- elseif (data(index,2)-0.3)<1e-5
- ybiao=6
- end
-
- if (data(index,3)-0.00)<1e-5
- zbiao=1
- elseif (data(index,3)-0.04)<1e-5
- zbiao=2
- elseif (data(index,3)-0.08)<1e-5
- zbiao=3
- elseif (data(index,3)-0.12)<1e-5
- zbiao=4
- elseif (data(index,3)-0.16)<1e-5
- zbiao=5
- elseif (data(index,3)-0.2)<1e-5
- zbiao=6
- end
读入的txt文件:
本帖隐藏的内容
nodetemp.txt
(8.86 KB)
结果图形:
法二:
这样的方法没代表性吧。 说白了,就是把这些node练成多边形,然后根据结点的温度填上结点的颜色。因为软件填色的本身设定,整个多边形就填上色。Matlab 可以做,Mathematica也可以做。因为你把那些结点关系省略了,我就用Interpolation来补充一下了。
data = Import["C/nodetemp.txt", "Table"]
data1 = Transpose[{data[[All, 1 ;; 3]], data[[All, 4]]}];
b = Max@data[[All, 4]];
a = Min@data[[All, 4]];
ff = Interpolation[data1, InterpolationOrder -> 1]
tt = RegionPlot3D[
0 <= x <= 0.2 && 0 <= y <= 0.3 && 0 <= z <= 0.2, {x, 0, 0.2}, {y,
0, 0.3}, {z, 0, 0.2}, Mesh -> {8, 5, 6}, PlotPoints -> {10, 7, 8},
MaxRecursion -> 0];
cls = Map[(ColorData["TemperatureMap"][(ff @@ # - a)/(b - a)]) &,
tt[[1, 1]]];
Row[{Graphics3D[{GraphicsComplex[
tt[[1, 1]], {Opacity[0.8], EdgeForm[],
Cases[tt[[1]], Polygon[__], {0, Infinity}]},
VertexColors -> cls]}, Axes -> True,
AxesLabel -> {"x", "y", "z"}, Boxed -> False, BoxRatios -> 1,
ViewPoint -> {-2, -2, 1}, ImageSize -> 350],
Graphics[DensityPlot[(y - a)/(b - a), {x, 0, 0.5}, {y, 22, 25},
ColorFunction -> (ColorData["TemperatureMap"][#1] &)][[1]],
Ticks -> {None, Range[22, 25, 0.5]}, Frame -> False, Axes -> True,
AspectRatio -> 10, ImageSize -> 45]}, Spacer[5]]





雷达卡




的时候,雨也是晴;心雨
的时候,晴也是雨!
京公网安备 11010802022788号







