如何使用Matlab可视化/绘制温度梯度? [英] How can I visualize/plot temperature gradient using matlab?

查看:413
本文介绍了如何使用Matlab可视化/绘制温度梯度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在3D矩形的特定点处有数据,我想查看温度梯度.我在特定点有值,但是我希望每个传感器之间有连续的梯度流.我无法弄清楚如何可视化或映射位于不同点的每个传感器之间的数据.卡住:(

I have data at specific points in 3D rectangle and I want to see temperature gradient. I have values at specific points , but I want a continous flow of gradient between each sensor. I am not been able to figure out how to visualize or map data in between each sensors placed at different points. stucked :(

X=[5 0 0 0 0 5 10 10 10 10 0 5 10 10 0 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 0 5 10 0 5 10 10 10 5 0 0]';
Y=[10 10 5 5 10 10 5 10 5 10 0 0 0 0 0 0 3.5 7 3.5 7 3.5 7 3.5 7 3.5 7 3.5 7 3.5 7 3.5 7 0 0 0 0 0 0 5 10 10 10 5 ]';
Z=[20 20 20 14 14 14 14 14 20 20 20 20 20 14 14 14 3.8 3.8 0 0 7.5 7.5 10 10 12.5 12.5 15 15 17.5 17.5 20 20 0 0 0 7.5 7.5 7.5 7.5 7.5 7.5 7.5 7.5]';
%# temperature vector
T = [20 22 24 22.1 26.1 22.4 15 17 21 22 19 22 18 17 18 20 21 22 21 24 22.3 22.5 22.8 28.9 22 27 26 20 19 24 21 23 19 18 22 25 27 21 29 25 22 21 22];
scatter3(X,Y,Z,[4000],T,'.');
grid off
box off
view(32,18); axis equal tight off vis3d; % azimuth 26
camproj perspective
camlight; lighting gouraud; alpha(0.75);
rotate3d on

下面的代码仅显示了我3d矩形的一侧应该是什么样子(它只是一个随机代码)

Code below just shows how my one side of 3d rectangle should look like(its just a random code)

datagrid = 500*peaks(100);
R = makerefmat('RasterSize',size(datagrid));
[aspect,slope,gradN,gradE] = gradientm(datagrid,R);
figure; axesm eqacyl
meshm(datagrid,R)
colormap (jet(64))
colorbar('vert')
title('Peaks: elevation')
axis square

推荐答案

您可以将问题分解为两个子问题:

You can break the problem down into two sub-problems:

  • 插值
  • 可视化

让我们先看一下插值.有许多可用的方法,但让我们尝试一下MATLAB函数griddatan.这会将值插值(线性)到一组新的点上(在这里,我使用了由meshgrid构造的常规网格).

Let's take a look at interpolation first. There are many methods available but let's try the MATLAB function griddatan. This will interpolate (linearly) values onto a new set of points (here I've used a regular grid constructed using meshgrid).

M = 20;
N = 20;
L = 40;

T = transpose(T);

% Set up the grid of points we wish to interpolate at
[xi,yi,zi] = meshgrid(linspace(0,10,M),linspace(0,10,N),linspace(0,20,L));

% Perform interpolation
ti = griddatan([X,Y,Z],T,[xi(:),yi(:),zi(:)]);

% Reshape back from a column vector to a MxNxL matrix
ti = reshape(ti, size(xi));

% Visualise in some way
scatter3(xi(:),yi(:),zi(:),400,ti(:),'.')

当涉及到可视化时,天空是极限,而3D体积的可视化更多是一门艺术,而不是一门科学.恐怕我无法运行您的示例(我无法访问makerefmat),但是

When it comes to visualization then the sky's the limit and 3D volume visualization is more of an art than a science. I'm afraid I can't run your example (I don't have access to makerefmat) but http://www.mathworks.co.uk/help/techdoc/visualize/bqliccy.html has some good starting points.

这篇关于如何使用Matlab可视化/绘制温度梯度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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