How to plot quiver with an input of Temperature data?

15 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Bjorn Gustavsson
Bjorn Gustavsson el 16 de Ag. de 2019
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 comentarios
Bjorn Gustavsson
Bjorn Gustavsson el 16 de Ag. de 2019
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
Alexandr Lozak el 16 de Ag. de 2019
Editada: Alexandr Lozak el 16 de Ag. de 2019
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

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by