
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. =const.
=const. = vector of n constants (length = n)
= vector of n constants (length = n) n=const
T = variable/vector (length = n)
How will you find the vector T?
Thanks !!!!
댓글 수: 0
채택된 답변
  Sam Chak
      
      
 2022년 6월 11일
        
      편집: Sam Chak
      
      
 2022년 6월 12일
  
      Hi @tom shneor
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
      
      
 2022년 6월 12일
				Hi @tom shneor
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.
추가 답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!














