Plotting 2D Temperature Distribution

조회 수: 1 (최근 30일)
Irfan Tahir
Irfan Tahir 2020년 11월 20일
댓글: KSSV 2020년 11월 20일
Hi, I am having a problem plotting 2d Temperature Distribution on a geometry.
I have solved it using Finite difference method,the temperatures of all the nodes.
That is the proble, i choose the mesh size of 0.05cm, i just need to draw and plot the temperatures obtained from the code the code is as below
clc
clear all
Tinf=295;
Tc=3350;
h_a=5; % air h
h_c=8800; % coolant h
h_cc=2350; % combustion chamber h
l=0.0005; % mesh size
k=14.9; % Thermal conductivity 304 Steel
h_a_f=h_a*l/k;
h_c_f=h_c*l/k;
h_cc_f=h_cc*l/k;
Ta=295;
Tc=183;
Tcc=3350;
% The grid has 31 nodes,
t1=[-2-h_a_f,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
t2=[1,-3-h_a_f,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
t3=[0,1,-3-h_a_f,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
t4=[0,0,1,-3-h_a_f,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
t5=[0,0,0,1,-2-h_a_f,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
t6=[1,0,0,0,0,-3,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
t7=[0,1,0,0,0,1,-4,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
t8=[0,0,1,0,0,0,1,-4,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
t9=[0,0,0,1,0,0,0,1,-4,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
t10=[0,0,0,0,1,0,0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25 25 10]);
axis([-5 30 -5 40]);
Just need to plot it, either by using coordinates or by rectangle or any command
  댓글 수: 1
KSSV
KSSV 2020년 11월 20일
If you have a matrix of temperature distribution, you can use pcolor to plot.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by