# Using ode45 for transient analysis

16 views (last 30 days)
louis marie on 7 Apr 2019
Answered: Torsten on 8 Apr 2019
Hi,
Quite inexperinced with MATLAB so apologies if the question is obvious but:
I need to use matlab to do a transient analysis of a mixed mode heat transfer (radiation and convection), and calculate time taken for a mass of water to increase to a certain temperature. As temperature increases it changes the heat transfer properites.
The equation I'm trying to use to calculate time is as follows:
dt = (Mw * Cw * dT)/(Adisc * (e*(q2 + q3 - (2 * sig * T^4))-(alp2 + alp3)*(T - Tamb)))
Everything is a constant except 'T' which is the water temperature and will vary while the water is heated. Now my problem is using ode45, because it appears I need to input a time span 'tspan':
[t,y] = ode45(odefun,tspan,y0)
This 'tspan' requires the final time, however, I am obviously trying to calculate the final time so not sure how I should be doing this.
Any help apreciated.

Torsten on 8 Apr 2019
First possibility:
Use the end time of integration big enough such that the water temperature surely exceeds the one you prescribe. Then read the time required to heat the water to the requested temperature from the t-T - plot.
Second possibility:
Use the event option of ODE45 to stop integration at the time where the water temperature reaches the one you request:
https://de.mathworks.com/help/matlab/math/ode-event-location.html