Clear Filters
Clear Filters

I want to do 2D colormap plot with a temperature gradient.

9 views (last 30 days)
The node size of the plate sets the length of one side to a square of 0.2. The number of nodes is set to 60 x 30. Divide the plate into six pieces. The values of the intermediate node in the six-division zone are as follows. [97.4, 99.7, 99.6; 103, 102, 102.5] This value means the temperature of Celsius. I want to check the process of changing this temperature through the node.
  1 Comment
Image Analyst
Image Analyst on 11 Dec 2021
Do you have a 2-D matrix of numbers that you want to display? If so, attach it in a .mat file.

Sign in to comment.

Answers (1)

Ayush
Ayush on 26 Apr 2024
Hey,
I understand that you want to know that how the specified intermediate temperature values, distributed across a 60x30 node grid divided into six pieces, evolve through the nodes of the plate.
To simulate and visualize the temperature distribution across a plate divided into six pieces in MATLAB, you can follow this approach.
Note: This example assumes an equal division along the longer side (60 nodes) for simplicity, but you can adjust the logic for other division schemes.
% Dimensions of the plate
numNodesX = 60; % X-direction
numNodesY = 30; % Y-direction
% Initialize the plate with a baseline temperature, for example, 20°C
plateTemperature = 20 * ones(numNodesY, numNodesX);
% Given intermediate node temperatures
intermediateTemps = [97.4, 99.7, 99.6; 103, 102, 102.5];
% Assuming the division is along the 60 node side into 6 pieces,
% and these temperatures are centrally located, we need to find the
% appropriate indices. This is a simplified assumption.
% For a more accurate placement, you would need exact locations.
% Calculate the width of one piece
pieceWidth = numNodesX / 6; % 60/6 = 10 nodes
% Assuming the temperatures are in the middle of each piece,
% and centrally located in the Y direction as well,
% we calculate the starting index for these nodes
startX = round(pieceWidth/2) - 1; % Adjust based on your indexing preference
startY = round((numNodesY - size(intermediateTemps, 1)) / 2);
% Insert the given temperatures into the plate matrix
for i = 1:size(intermediateTemps, 2)
offsetX = (i-1) * pieceWidth;
for j = 1:size(intermediateTemps, 1)
plateTemperature(startY+j, startX+offsetX+1:startX+offsetX+3) = intermediateTemps(j, i);
end
end
For a 2D colormap plot of the temperature distribution across the plate in MATLAB, you can refine the visualization aspect using the "colormap" function along with "imagesc" in the following way:
% Assuming the initial setup and temperature insertion has been completed
% Visualize the temperature distribution with colormap
figure;
imagesc(plateTemperature);
colorbar; % To show the temperature scale
colormap('jet'); % Use the 'jet' colormap for better visualization
title('2D Colormap of Temperature Distribution Across the Plate');
xlabel('Node Position in X-direction');
ylabel('Node Position in Y-direction');
% Enhance the plot with grid lines to delineate the divisions
xticks([0:10:numNodesX]); % Adjust the tick positions based on your divisions
yticks([0:5:numNodesY]);
grid on; % Enable grid
axis equal tight; % Adjust axis scaling and limits
For more information on 'colormap' function, refer to the following MathWorks documentation link: https://in.mathworks.com/help/matlab/ref/colormap.html
I hope this helps!

Categories

Find more on Colormaps in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!