How do I solve a second order ode with time dependent terms?

I am trying to solve the turbulent heat transfer equation and I am not able to make the ode function.
The equation shown above is the one I am trying to solve. I am solving for temperature (T*) and the function f is not explicitly known. I have a matrix which contains the values of f, f' and f'' (the function f, its first and second derivative). The ode function which I made was as follows: (ETA_1 is the independent variable and T_1 is the dependent variable)
function T_out_1 = ODE_1_THERM(ETA_1,i,j,T_1,beta,y_out_1_final,ETAspan_1,Pr,Pr_t)
T_out_1 = zeros(2,1);
T_out_1(:,1) = T_1(:,2);
T_out_1(:,2) = -(y_out_1_final(:,1,j)+beta(1,j)*ETAspan_1(:,i,j).*y_out_1_final(:,3,j)/Pr_t + beta(1,j)*ETAspan_1(:,i,j).^2.*y_out_1_final(:,4,j)/(2*Pr_t))...
*T_1(2)/(1/Pr+beta(1,j)*ETAspan_1(:,i,j).^2.*y_out_1_final(:,3,j)/(2*Pr_t));
end
The vector ETAspan contains values of ETA itself and y_out_1_final is the matrix where I have stored the values of the function f and its derivative at different values of ETA corresponding to ETAspan.

 Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 16 Mai 2020

0 Stimmen

Your equation seems correct. To introduce a time-varying parameter, see this example: https://www.mathworks.com/help/releases/R2020a/matlab/ref/ode45.html#bu3uhuk. It shows how to use interp1() to use datapoints as time-varying parameters.

1 Kommentar

I figured out my mistake. I really had to use the interpol function to make the number of elements of my parameters compatible with the independent and dependent variables in the equation.
Thanks a lot! :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by