MATLAB Answers

0

How to plot quiver with an input of Temperature data?

Asked by Alexandr Lozak on 16 Aug 2019
Latest activity Edited by Alexandr Lozak on 16 Aug 2019
I have temperature data of a sample (V=(28,30,4997)). Each V(:,:,i) is a matrix with temperature values. I want to plot a quiver of temperature dissipation/accumulation and temperature image at the same time but i am a bit confused with inputs for u and v vectors. What u and v should be if i have only matrices of temperature?
My code:
[x,y]=meshgrid(1:1:30,1:1:28);
k=4997;
cnt=0;
for i=1:k
u(:,:,i)=V(:,:,i);
v(:,:,i)=V(:,:,i);
%figure
imagesc(V(:,:,i));
hold on
axis tight
q=quiver(x,y,u(:,:,i),v(:,:,i))
q.AutoScale='on';
q.AutoScaleFactor=0.8;
colormap jet
cnt=i;
title(cnt);
pause (0.1)
end

  0 Comments

Sign in to comment.

1 Answer

回答者: Bjorn Gustavsson 2019 年 8 月 16 日
 採用された回答

Presumably your heat-flux is just proportional to the temperature gradient (assuming constant and isotropic heat conductivity), for that I would start with:
[dTdx,tTdy] = gradient(V(:,:,i));
u(:,:,i) = -heat_conductivity*dTdx;
v(:,:,i) = -heat_conductivity*dTdy;
If you want total change in thermal energy per pixel you'll have to add local heating and subtract local cooling, for this the contribution of heat condution will be proportional to the divergence of the heat-flux. If you image a fluid that moves you'll also have to take the effect of convection into account. If the above suggestion doesn't work you have to clarify your question.
HTH

  3 Comments

Alexandr Lozak 2019 年 8 月 16 日
Thank you for the answer!
Could you please explain bit more for total change in thermal energy per pixel?
(how i can calculate local heating and cooling?)
I have an object which is loaded over time. And we have generation of heat in the central part of object. And i want to show flow of temperature and accumulation of temperature with quiver or quiver3.
Typically the temperature in a volume is determined by an energy-equation, right? That would look something like this:
Where n, T, v, Q and L are functions of both time and position (there are a couple of numerical factors left out in the equation above). Term on left-hand side is the time-variation of temperature, the right-hand side describes the various contributions to temperature variations - convection, compression (i.e. change due to divergence of particle flow), divergence of heat-flux, local heating and local cooling. Now, since you have a sequence of images of the temperature-variation, you shouldn't need to bother too much with the above equation (losely valid for gas-temperature distribution with arbitrary wind field and local heating and cooling sources.)
You should get the local change in temperature simply from the difference between consecutive temperature-images:
where dT is positive the temperature has increased and also the thermal energy. If you look at the difference images and compare with the quiver-plot of the tempeature gradient you should be able (in the best case) to see if you have regions with net influx (or outflux) of thermal energy.
HTH
Alexandr Lozak 2019 年 8 月 16 日
Thank you very much for such great and detailed answer!
Now i am bit confused in generation of z and w vectors for quiver3. Could you please show, which way u,v, z and w vectors could be generated for V(:,:,4997)?
my code:
for i=1:4997
zmin(i)=min(min(V(:,:,i)));
zmax(i)=max(max((V(:,:,i))));
end
zmi=min(zmin(:));
zma=max(zmax(:));
% i thought that i have to find limits of z for mesh this way
[x,y,z]=meshgrid(1:1:30,1:1:28,zmi:1:zma);
k=4997;
heat_conductivity=28;
for i=1:k
% [u,v,w] = surfnorm(z);
[dTdx,dTdy] = gradient(V(:,:,i));
u(:,:,i) = -heat_conductivity*dTdx;
v(:,:,i) = -heat_conductivity*dTdy;
% I cant understand which way i can describe/generate Z and W from my data
surf(V(:,:,i));
hold on
axis tight
q=quiver3(x,y,Z,u(:,:,i),v(:,:,i),W,0.5);
q.AutoScale='on';
pause (0.1)
end

Sign in to comment.