来自4行向量的4D图(3D +彩色) [英] 4D plot (3D+color) from 4 row vectors

查看:107
本文介绍了来自4行向量的4D图(3D +彩色)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有4个行向量x, y, z and s,它们的大小均相等1*size. x, y, z应该是三个笛卡尔坐标轴,并且s应该用颜色表示(我想要下图所示的图像).语句Surf不接受行向量.我已经阅读了几篇stackoverflow文章,但是找不到答案.如何绘制这样的数字? 非常感谢您能提供的任何帮助.

I have 4 row vectors x, y, z and s, all of them have equal sizes 1*size. x, y, z should be the three Cartesian corodinate axes and s should be represented by colors (I want figure like below image). The statement Surf does not accept row vectors. I have read several stackoverflow post, but I could not find the answer. How can I plot such a figure? I really appreciate any help you can provide.

推荐答案

您可以尝试使用3D网格的3D立方体示例,并绘制温度"图.

You can try with this example of a 3D cube for a 3D meshgrid and it plots the "temperature".

L = 1;
dx = 0.25;
dy = dx;
dz = dy;
Nx = L/dx;   Ny = Nx;    Nz = Ny;
x = dx/2:dx:L-dx/2;
y = x;       z = y;
[xx, yy, zz] = meshgrid(x,y,z);
theta = NaN(size(zz));

for jj=1:4;
    for ii=1:4
        for kk=1:4
            theta(jj,ii,kk) = 273.15 + 5.*random('normal', 0, 1)
        end
    end
end

clf
isosurface(xx, yy, zz, theta)
colorbar
colormap jet
[fe, ve, ce] = isocaps(x, y, z, theta, 10);
p2 = patch('Faces', fe, 'Vertices', ve, 'FaceVertexCData', ce);
p2.FaceColor = 'interp';
p2.EdgeColor = 'none' ;
grid on
xlabel('X (m)');
ylabel('Y (m)');
zlabel('Z (m)');
title('Temperatures');
set(gca, 'clim', [273.15 273.15+5])
set(get(colorbar, 'title'), 'string', 'K', 'FontW', 'bold', 'fontname', 'Times New Roman', 'fontsize', 14);
view(3)

这篇关于来自4行向量的4D图(3D +彩色)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆