HELLO
I would I would be grateful if you could help me.
i have a system of ODE that i want to solve with ode45;
i used if statment but it didn't seem to work properly (it gives the solution for just one condition)
the function is : function F = ODEfun(t,y)
the system is given below
i defined the ode45 solver:
[t, y] = ode45(@ODEfun,tspan,y0);F = [dydt(1);dydt(2);dydt(3)];
and this is the system
%===========================================================================================
rho_w = a_1 * y(2)^2 + b_1 * y(2) + c_1;%=========================================================================================
hC = a_2*y(1) + b_2 + c_2 + d_2;% ================================ Differential equations =========================================
% ================================ water content =========================================
if y(2)<T_b dydt(1) = Q*(phi*V_total-y(1))/(phi_eff*V_total); elseif y(2)>= T_b dydt(1) = -(h*A_s/(rho_w * L_v))*(y(2) - T_b); elseif y(2)<T_b dydt(1) = 0; end%========================================== temperature===================
if y(2) < T_b dydt(2) = ( 1 / hC ) * ( Pw - ( k * (y(2) - T_inf ) * A_cyl / d_inf ))... - Q * ( rho_w * c_w * ( y(2) - T_inf)/hC)* ((phi * V_total - y(1) ) /... phi_eff*V_total);elseif y(2)>= T_b dydt(2) = ( 1 / hC ) * ( Pw - ( k * (y(2) - T_inf ) * A_cyl / d_inf ))... - ( rho_w * L_v * h * A_cyl * (y(2) - T_b) / (hC * rho_w * L_v));elseif y(2)<T_b dydt(2) = ( 1 / hC ) * ( Pw - ( k * (y(2) - T_inf ) * A_cyl / d_inf ));end%=============================================Distance ======================
if y(2)<T_b dydt(3) = 0;elseif y(2)>= T_b dydt(3) = (h * A_s / (rho_w * L_v * A ) ) * ( y(2) - T_b );elseif y(2)<T_b dydt(3) = -Q / A;end
Best Answer