Different answer using ODE45 and symbolic solve
Show older comments
I've been working through a problem using 2 different methods to solve the time required to reach 135C. One uses ode45 where I iterate through and find that its roughly 162.6 seconds but when I try a different method using symbolic int and solve I get 170 seconds. I can't figure out what's causing the different results.
tspan = [0:0.1:180]
y_0=25
[t T] = ode45(@odefun,tspan,y_0)
Temp=T(1627,1)
time=t(1627,1) % using ode45
time_2=answer_2() % using symbolic solve
function dtdT = odefun(t,T)
A=0.04;
l=0.007;
V=A*l;
h=10;
q_h=1.25*10^4;
sigma = 5.67*10^-8;
C=900;
p=2800;
e=0.80;
T_i=25;
B=(q_h - h*(T-T_i) - ( e*sigma*(T^4 - T_i^4)));
D=A/(V*C*p);
dtdT = D*B;
end
function A=answer_2()
syms t
A=0.04;
l=0.007;
V=A*l;
h=10;
q_h=1.25*10^4;
sigma = 5.67*10^-8;
C=900;
p=2800;
e=0.80;
T_i=25;
T=135;
B=(q_h - h*(T-T_i) - ( e*sigma*(T^4 - T_i^4)));
D=A/(V*C*p);
Solution = double(solve( T-T_i == (D*int(B,t,0,t)),t));
A=Solution;
end
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!