Trying to calculate the temperature from the equilibrium heat equation

조회 수: 3 (최근 30일)
Hello everyone,
I am trying to calculate the temperature from the equation :
The state of each parameter:
m = const.
= const.
=const.
= vector of n constants (length = n)
n=const
T = variable/vector (length = n)
How will you find the vector T?
Thanks !!!!

채택된 답변

Sam Chak
Sam Chak 2022년 6월 11일
편집: Sam Chak 2022년 6월 12일
Edit: This is a little difficult for me to imagine since the values of the parameters are not provided. assuming that m, Cp, Qemit are all ones, create and save the odefcn.m function m-file:
function dTdt = odefcn(t, T, Qtot)
dTdt = (- 1*T^4 + Qtot)/(1*1);
end
Run at the Command Window to create the parameters needed for the ODE solver
Qtot = 1:5;
Tfinal = 10; % final simulation time
Ts = Tfinal/length(Qtot); % uniform time interval
T0 = 0; % initial Temperature value
Create a for loop to pass the value of Qtot at certain time intervals for ode45 to solve and plot T vs. t continuously at each time interval.
for k = 1:length(Qtot)
tspan = [Ts*(k-1) Ts*k];
[t, T] = ode45(@(t, T) odefcn(t, T, Qtot(k)), tspan, T0);
T0 = T(end); % last value of T assigned as new initial value for next interval
plot(t, T, 'linewidth', 1.5, 'b-')
hold on % hold current figure to continue plotting for the next interval
end
hold off
Display axes grid lines and add axis labels for informative reasons.
grid on
xlabel('t', 'fontsize', 14)
ylabel('T', 'fontsize', 14)
  댓글 수: 9
Sam Chak
Sam Chak 2022년 6월 12일
Since you are hesitate to provide at least some sample values, I have edited my Answer and tried to make the code as informative as possible. But that is not the way I normally run simulation due to the lack of the time-dependent data information about Qtot. Anyway, hope it helps.
Torsten
Torsten 2022년 6월 12일
편집: Torsten 2022년 6월 12일
time = 0:50;
Qtot = 10:10:510;
tfinal = 50;
T0 = 0;
fun = @(t,T) (- 1*T^4 + interp1(time,Qtot,t))/(1*1);
tspan = [0 tfinal];
[t,T] = ode45(fun,tspan,T0);
plot(t,T)

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by