我现在有一组三维地震数据,大小为625201201,.mat文件,请问怎么用matlab绘制出和下面类似的图形。
![](https://profile-avatar.csdnimg.cn/60cf4b1368f34df79bbddd8ed12981e1_weixin_49041844.jpg!4)
matlab绘制三维地震数据图像
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- 技术专家团-Joel 2021-11-27 16:52关注
你好,可以建立类似的单元,然后进行涂色处理
m = 625; n = 201; p = 201; A = zeros(m,n,p); B = A(1:30:m, 1:10:n, 1:10:p); [s,r,t] = size(B); [node, element]= rectC3D8([s,r,t], [s,r,t]); faceNumber = size(element,1)*6; pV = randi([0,10], faceNumber, 1); solidPatch(element, node, pV, 'C3D8'); colormap(hsv(10))
函数程序
function [node, element]= rectC3D8(a, ndiv) % author: Ji Wan, Wuhan University, Email: wanji@whu.edu.cn % date: 2021\06\25 [x, y, z] = meshgrid(linspace(-a(1)/2, a(1)/2, ndiv(1)+1), ... linspace(-a(2)/2, a(2)/2, ndiv(2)+1),... linspace(-a(3)/2, a(3)/2, ndiv(3)+1)); %% 8 nodes [p1, q1, r1] = meshgrid(1:ndiv(1), 1:ndiv(2), 1:ndiv(3)); pos1 = sub2ind([ndiv(1)+1, ndiv(2)+1, ndiv(3)+1], p1, q1, r1); [p1, q1, r1] = meshgrid(2:ndiv(1)+1,1:ndiv(2), 1:ndiv(3)); pos2 = sub2ind([ndiv(1)+1, ndiv(2)+1, ndiv(3)+1], p1, q1, r1); [p1, q1, r1] = meshgrid(2:ndiv(1)+1, 2:ndiv(2)+1, 1:ndiv(3)); pos3 = sub2ind([ndiv(1)+1, ndiv(2)+1, ndiv(3)+1], p1, q1, r1); [p1, q1, r1] = meshgrid(1:ndiv(1),2:ndiv(2)+1, 1:ndiv(3)); pos4 = sub2ind([ndiv(1)+1, ndiv(2)+1, ndiv(3)+1], p1, q1, r1); [p1, q1, r1] = meshgrid(1:ndiv(1), 1:ndiv(2), 2:ndiv(3)+1); pos5 = sub2ind([ndiv(1)+1, ndiv(2)+1, ndiv(3)+1], p1, q1, r1); [p1, q1, r1] = meshgrid(2:ndiv(1)+1,1:ndiv(2), 2:ndiv(3)+1); pos6 = sub2ind([ndiv(1)+1, ndiv(2)+1, ndiv(3)+1], p1, q1, r1); [p1, q1, r1] = meshgrid(2:ndiv(1)+1, 2:ndiv(2)+1, 2:ndiv(3)+1); pos7 = sub2ind([ndiv(1)+1, ndiv(2)+1, ndiv(3)+1], p1, q1, r1); [p1, q1, r1] = meshgrid(1:ndiv(1),2:ndiv(2)+1, 2:ndiv(3)+1); pos8 = sub2ind([ndiv(1)+1, ndiv(2)+1, ndiv(3)+1], p1, q1, r1); element = [reshape(pos1, numel(pos1), 1),... reshape(pos2, numel(pos2), 1),... reshape(pos3, numel(pos3), 1),... reshape(pos4, numel(pos4), 1),... reshape(pos5, numel(pos5), 1),... reshape(pos6, numel(pos6), 1),... reshape(pos7, numel(pos7), 1),... reshape(pos8, numel(pos8), 1),... ]; node = [reshape(permute(x,[2,1,3]),numel(x),1),... reshape(permute(y,[2,1,3]), numel(y),1)... reshape(permute(z,[2,1,3]), numel(z),1)]; end
函数程序2
function h = solidPatch(element, node, patchVal, eType) % author: Ji Wan, Wuhan University, Email: wanji@whu.edu.cn % date: 2021\06\25 e = element; n = node; switch eType case {'C3D8','C3D9'} faces = zeros(size(e, 1)*6, 4); eface = [1,4,3,2; 5,6,7,8; 1,2,6,5; 2,3,7,6; 3,4,8,7; 5,8,4,1]; for i = 1:1:size(e, 1) pe = e(i,:); faces((i-1)*6+1:i*6,:) = pe(eface); end case {'C3D27','C3D20'} faces = zeros(size(e,1)*6, 8); eface = [ 1,9,2,18,6,13,5,17; 2,10,3,19,7,14,6,18; 3,11,4,20,8,15,7,19; 4,12,1,17,5,16,8,20; 1,12,4,11,3,10,2,9; 5,13,6,14,7,15,8,16; ]; for i = 1:1:size(e,1) pe = e(i,:); faces((i-1)*6+1:i*6,:) = pe(eface); end end h = patch('Faces',faces,'Vertices',n,'FaceVertexCData',patchVal,... 'EdgeColor','k','FaceColor','flat','LineWidth',0.01); colormap(jet) axis equal axis off view([-37.5,30]) end
效果:
如有帮助还望题主给个宝贵的采纳支持一下答主答题哟,谢谢啦(づ ̄3 ̄)づ╭❤~
解决 无用评论 打赏 举报
悬赏问题
- ¥15 IEC61850库中IedServer_setControlHandler函数的作用
- ¥15 qt 编译webengine 支持 webgl
- ¥15 Cadence安装后pcb design可以打开,Capture CIS闪退
- ¥15 python中post报错
- ¥20 关于#java#的问题:根据学生字段为集中分班还是分散分班,如何根据规则集合实现综合分班,分班规则由集合数据顺序由强到弱
- ¥15 暴雪战网api相关问题
- ¥15 而使用UE5引擎的 工具选项里 打开c++ visual studio 就会有部分显示加载失败 如图 加载失败的这张图 请问是什么原因
- ¥15 mysql 对多个字段模糊查询,返回第一个匹配的字段
- ¥15 the testing results of the whole dataset is empty
- ¥15 can问题,往哥解决