how to solve differential equations

Hi, I'm trying to solve these differential equations with ode45, but i I don't understand how to enter the boundary conditions.
Th,in end tc,in are constant
Could you help me about it? Thank you

4 comentarios

Star Strider
Star Strider el 25 de Jul. de 2016
Use bvp4c or bvp5c for boundary value problems.
UGO mela
UGO mela el 26 de Jul. de 2016
Thanks for your reply I can not understand how to determine the term solinit of the function.
Torsten
Torsten el 26 de Jul. de 2016
solinit = bvpinit(linspace(0,L,100),[Th_in Tc_in Th_in Tc_in Th_in Tc_in Th_in Tc_in Th_in Tc_in]);
Best wishes
Torsten.
UGO mela
UGO mela el 26 de Jul. de 2016
Editada: UGO mela el 26 de Jul. de 2016
I would like to know if I set good function . I set equal 1 all terms W, U, c1.... that are constant except T
Tc_in=5;
Th_in=20;
function dydx=exlode(x,T)
dydx=[(T(2)-T(1)
T(1)+T(3)-2*T(2)
-(T(2)+T(4)-2*T(3))
-(T(3)+T(5)-2*T(4))
T(4)+T(6)-2*T(5)
T(5)+T(7)-2*T(6)
-(T(6)+T(8)-2*T(7))
-(T(7)+T(9)-2*T(8))
T(8)+T(10)-2*T(9)
T(9)-T(10)];
function res=ex1bc(T0,TL)
res=[T0(1)-20 %Tc=20
T0(2)-5 %Tf=5
TL(3)-TL(1)
TL(4)-TL(2)
T0(5)-T0(3)
T0(6)-TL(4)
TL(7)-TL(5)
TL(8)-TL(6)
T0(9)-T0(7)
T0(10)-T0(8)];
solinit = bvpinit(linspace(0,L,100),[Th_in Tc_in Th_in Tc_in Th_in Tc_in Th_in Tc_in Th_in Tc_in]);
sol = bvp4c(@ex1ode,@ex1bc,solinit);
Thank you

Iniciar sesión para comentar.

Respuestas (1)

Torsten
Torsten el 26 de Jul. de 2016
function main
L=...;
Th_in = 20;
Tc_in = 5;
solinit = bvpinit(linspace(0,L,100),),[Th_in Tc_in Th_in Tc_in Th_in Tc_in Th_in Tc_in Th_in Tc_in]);
sol=bvp4c(@ex1ode,@(T0,TL)ex1bc(T0,TL,Th_in,Tc_in),solinit);
function dydx=exlode(x,T)
dydx=[(T(2)-T(1)
T(1)+T(3)-2*T(2)
-(T(2)+T(4)-2*T(3))
-(T(3)+T(5)-2*T(4))
T(4)+T(6)-2*T(5)
T(5)+T(7)-2*T(6)
-(T(6)+T(8)-2*T(7))
-(T(7)+T(9)-2*T(8))
T(8)+T(10)-2*T(9)
T(9)-T(10)];
function res=ex1bc(T0,TL,Th_in,Tc_in)
res=[T0(1)-Th_in
T0(2)-Tc_in
TL(3)-TL(1)
TL(4)-TL(2)
T0(5)-T0(3)
T0(6)-TL(4)
TL(7)-TL(5)
TL(8)-TL(6)
T0(9)-T0(7)
T0(10)-T0(8)];
Best wishes
Torsten.

5 comentarios

UGO mela
UGO mela el 26 de Jul. de 2016
How does the function become if I have only the first equation?
Thank you Ugo
Torsten
Torsten el 26 de Jul. de 2016
But - as it stands - you can't solve the first equation without solving the second equation, too ...
Best wishes
Torsten.
UGO mela
UGO mela el 26 de Jul. de 2016
I would like to include this equation with the same function.
How can I do? Thank you
Torsten
Torsten el 27 de Jul. de 2016
This is an initial-value problem.
Use ODE45 instead of BVP4C to solve
dT/dx = -N*U/L * T^2 T(x=0) = 40
( Solution is T(x)=1/(1/40+N*U/L * x) )
Best wishes
Torsten.
UGO mela
UGO mela el 27 de Jul. de 2016
Sorry for my questions, but I use recently Matlab. When I solved the first system of equations , I plotted the results and I found a strange result on the last T ( 10 ) . All functions with index even T(2), T(4).... are growing except the last T (10) . Could it be link to the function?
The first part of the graphic is link to the odd index [T(1), T(3)..] the second part is link to the even index [T(2), T(4)...]

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Preguntada:

el 25 de Jul. de 2016

Comentada:

el 27 de Jul. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by