필터 지우기
필터 지우기

I need to iterate time(t) to get different value of temperature(T) at different (t) starting from 0. Can anyone help me to iterate the code and plot time vs temperature curve?

조회 수: 2 (최근 30일)
T_i = 80;
T_inf = 15;
h = 50;
A = 13.16;
m =54;
t = 0;
m_c = 28; %mass of cast iron in kg
m_co = 20; %mass of copper winding in kg
m_s = 6; %mass of steel shaft in kg
C_c = 0.460; %Heat capacity of cast iron in KJ/Kg-K
C_co = 0.377; %Heat capacity of copper in KJ/Kg-K
C_s = 0.502; %Heat capacity of steel in KJ/Kg-K
c = m_c*C_c+m_co*C_co+m_s*C_s;
T = (T_i-T_inf)*exp((-h*A*t)/(m*c)) + T_inf

채택된 답변

Awais Saeed
Awais Saeed 2021년 12월 13일
편집: Awais Saeed 2021년 12월 13일
T_i = 80;
T_inf = 15;
h = 500;
A = 13.16;
m = 54;
m_c = 28; %mass of cast iron in kg
m_co = 20; %mass of copper winding in kg
m_s = 6; %mass of steel shaft in kg
C_c = 0.460; %Heat capacity of cast iron in KJ/Kg-K
C_co = 0.377; %Heat capacity of copper in KJ/Kg-K
C_s = 0.502; %Heat capacity of steel in KJ/Kg-K
c = m_c*C_c+m_co*C_co+m_s*C_s;
stepsize = 0.01;
time = 0:stepsize:2;
for ii = 1:1:length(time)
t =time(ii);
T(ii) = (T_i-T_inf)*exp((-h*A*t)/(m*c)) + T_inf;
end
plot(time, T)
title('t vs T plot')
xlabel('t')
ylabel('T')
set(gca,'XTick',min(time):0.1:max(t)); % start time, increment size, stop time

추가 답변 (1개)

Walter Roberson
Walter Roberson 2021년 12월 13일
T_i = 80;
T_inf = 15;
h = 500;
A = 13.16;
m =54;
syms t
m_c = 28; %mass of cast iron in kg
m_co = 20; %mass of copper winding in kg
m_s = 6; %mass of steel shaft in kg
C_c = 0.460; %Heat capacity of cast iron in KJ/Kg-K
C_co = 0.377; %Heat capacity of copper in KJ/Kg-K
C_s = 0.502; %Heat capacity of steel in KJ/Kg-K
c = m_c*C_c+m_co*C_co+m_s*C_s;
T = (T_i-T_inf)*exp((-h*A*t)/(m*c)) + T_inf
T = 
fplot(T, [0 2])
  댓글 수: 3
Walter Roberson
Walter Roberson 2021년 12월 13일
T_i = 80;
T_inf = 15;
h = 500;
A = 13.16;
m =54;
syms t
m_c = 28; %mass of cast iron in kg
m_co = 20; %mass of copper winding in kg
m_s = 6; %mass of steel shaft in kg
C_c = 0.460; %Heat capacity of cast iron in KJ/Kg-K
C_co = 0.377; %Heat capacity of copper in KJ/Kg-K
C_s = 0.502; %Heat capacity of steel in KJ/Kg-K
c = m_c*C_c+m_co*C_co+m_s*C_s;
T = (T_i-T_inf)*exp((-h*A*t)/(m*c)) + T_inf
T = 
maxt = 2;
x = linspace(0,maxt,250);
Y = double(subs(T, t, x))
Y = 1×250
80.0000 77.3409 74.7907 72.3447 69.9988 67.7489 65.5910 63.5214 61.5364 59.6327 57.8068 56.0557 54.3761 52.7653 51.2204 49.7387 48.3175 46.9546 45.6474 44.3936 43.1912 42.0379 40.9318 39.8710 38.8535 37.8777 36.9418 36.0442 35.1833 34.3577
plot(x, Y)
xticks(0:.1:maxt)
The Y= part shows the values at the command line, as you requested.

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

카테고리

Help CenterFile Exchange에서 Thermal Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by