Trying to calculate the temperature from the equilibrium heat equation

3 vues (au cours des 30 derniers jours)
tom shneor
tom shneor le 11 Juin 2022
Modifié(e) : Torsten le 12 Juin 2022
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 !!!!

Réponse acceptée

Sam Chak
Sam Chak le 11 Juin 2022
Modifié(e) : Sam Chak le 12 Juin 2022
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 commentaires
Sam Chak
Sam Chak le 12 Juin 2022
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 le 12 Juin 2022
Modifié(e) : Torsten le 12 Juin 2022
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)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by