I have the following equation and I want to solve this equation for 10525 timestep (for a day) to get the "Tm" values. However, I am getting error.
This is actually a simple energy balance:
Qstore = Qinj - Qemitted
dTm/dt = 1/C_rad * ((Qinj)- (C*(Tm-Tair).^n))
In the above equation all other parameters are constant except ''Qinj''. Qinj is actually the heat injected to the radiator and it has a step change. I am using ODE45 to solve this. The purpose is to observe the change in Tm by changing the Qinj.
So I want to solve the above equation for 10525 different timesteps to get the Tm for each data point. Since this is the continuous data so the initial value for Tm (Tm0) for the next timestep will be equal to the Tm value for the previous timestep (Becuase this is the time-series data).
I have following code. Can anyone please help me to fix this problem? Thanks in advance!
n = 1.3581 ;
Tsu = 75;
Tair = 21;
C_rad = 5.7770e+04;
step = 10524;
tspan =[0 0.0022805];
t0 = 0;
t1 = 24;
t = linspace(t0 , t1 , (step+1));
[num txt raw] = xlsread('Radiator_sweep190.xlsx');
Qinj_t = num(:,4); (10525X1)
Qinj_td = interp1(tQinj, Qinj_t, t, 'linear');
Tmo = 20 ;
[t,Tm] = ode45(@(t,Tm) rad_h(t, Tm, tQin, C_rad, Qinj_td, C, Tair, n ),tspan,Tmo);
function dtmdt = rad_h(t, Tm, tQin, C_rad, Qinj_td, C, Tair, n )
dtmdt = 1/C_rad*((Qinj_td)- (C*(Tm-Tair).^n))