1-D Temperature Gradient

Hey everyone,
I am trying to figure out how to draw a temperature gradient of a 1-D system. I have tried to understand meshgrid but I couldn't find a way out. Plus, I have tried to use contourf but still didn't work for me. I might be using these functions wrong.
I have 19 different points and all of those points have the same x-coordinate value, only their y-coordinate values change. For example, Point_1(0, 1), Point_2(0,2), Point_3(0,3)... Basically, they form a vertical line on a coordinate system. Also, I have corresponding temperatures for every point. I want to plot a temperature gradient looking like color bars standing next to graphs but I couldn't find a proper way to do that. Could any of you please help me out to understand how to do that?

9 comentarios

Image Analyst
Image Analyst el 4 de Mayo de 2021
"I have 19 different points" <=== well, what are they? You forgot to include them, so what can we do???
Kubilay Akpinar
Kubilay Akpinar el 5 de Mayo de 2021
I am working on transient heat transfer analysis of a converyor belt with a mixture on it. I assume that heat transfer occurs in only one direction (x-direction) and it changes with time. Those points are the centers of nodes that I use to examine the system. I calculated temperature of every node and I want to put those data on a temperature gradient. Undermost node will be the coolest one and the uppermost node will be the hottest one. Here is how it looks;
J. Alex Lee
J. Alex Lee el 5 de Mayo de 2021
I guess you want a contour plot of temperature on a plane of x-position and time? so you need your temperatures at every x-node at a series of times...you didn't mention if you have that?
Kubilay Akpinar
Kubilay Akpinar el 5 de Mayo de 2021
Yes, this is exactly what I want to do. And also yes, I have temperature values for every instant of time. Time varies from 0 to 50 seconds with 0.005 seconds increments.
J. Alex Lee
J. Alex Lee el 5 de Mayo de 2021
Based on your responses, it seems you were on the right track with using meshgrid() to "hang" your temperature data onto using something like contourf(). But to be more helpful, like Image Analyst says, need more details, ideally your data too. Is your temperature data in 10,000 different "lists" of 19 elements? Already in a matrix that is 19x10,000?
Kubilay Akpinar
Kubilay Akpinar el 6 de Mayo de 2021
Sorry for late response, my temperature data is in a 3D matrix 1x19x10,000 and the nodal center points are in a matrix 1x19.
Image Analyst
Image Analyst el 8 de Mayo de 2021
Not sure why you're refusing to attach your data though. Make it easy for people to help you, not hard.
Anyway, did you try the answer below?
Kubilay Akpinar
Kubilay Akpinar el 8 de Mayo de 2021
Editada: Kubilay Akpinar el 8 de Mayo de 2021
I am not refusing to share my data. I am a newbie here and that's the main reason why I am having difficulties to explain what I want and what I have.
I have the y-coordinates of nodes starting from zero to total thickness of conveyor belt and the mixture on it with deltax increments.
deltax = 0.5 [mm]
x_tot = 9 [mm] %Total thickness of belt + mixture
yp = (0 : deltax : x_tot) % Y-Coordinates of nodes
My time vector is
v_belt = 0.6 [m/s]
L_belt = 30 [m]
t_cont = L_belt / v_belt %Duration which mixture is contact with conveyor belt
delta_t = 0.005
N_times = t_cont / delta_t %Number of time steps
And after executing an explicit solver I get my temperature values for each node for each time step which is a vector of 19 x 10000 (node_num x N_times). Let's say
T_final = rand(numel(yp), N_times)
I tried the answer below, but it doesn't give me what I want, I am still searching for the answer but I am not sure if the answer is correct and I am doing something wrong. That's why I haven't accepted this answer yet.
When I use the code given below I get this
This result is not wrong, the code given works fine.
However, I tried to use imagesc function and I got this result, but still it is not what I exactly want, because this function returns an image as far as I understand.
What I want is to apply this imagesc function result onto mesh grid that I shared in my previous comments. To be more specific, the colorbar standing next to imagesc function result looks like excatly what I desire to do just mesh (or node) lines are missing. That's why I thought I should use meshgrid and then contourf function at first.
I hope this comment makes it easier to understand my problem. I don't have any intentions to make it complicated to get some help from you. Thank you for your understanding and effort.
J. Alex Lee
J. Alex Lee el 11 de Mayo de 2021
what exactly is it about the result "which is not wrong" that isn't what you want?

Iniciar sesión para comentar.

Respuestas (1)

J. Alex Lee
J. Alex Lee el 7 de Mayo de 2021
Editada: J. Alex Lee el 7 de Mayo de 2021

0 votos

your time and space point vectors are
t = 0:0.005:50; % but this gives you 10,001 points, not 10,000...so you decide what you have
x = linspace(0,9,19); % just guessing based on your image
making up some temperature matrix with the dimensions you have
tmp = rand(1,numel(x),numel(t));
it is senseless to have your first dimension in your temperature data matrix, so need to squeeze out the first dimension
tmp_a = squeeze(tmp);
turns out you don't even need meshgrid because contourf will imply it for you (if you get the order of dimensions right)
contourf(t,x,tmp_a)
or if you want t and x transposed
contourf(x,t,transpose(tmp_a))

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Productos

Versión

R2020a

Preguntada:

el 4 de Mayo de 2021

Comentada:

el 11 de Mayo de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by