Help on error while trying to solve differential equation
Mostrar comentarios más antiguos
I am trying to solve a differential equation, then find a condition that returns a specific result, but I am getting the following error: "Warning: Unable to find explicit solution. Returning implicit solution instead. . Undefined function or variable 'Tsol'." I have never solved differential equations on MATLAB before so I'd like to at least solve this equation first.
%Declare variables
C_1 = 1.27575*10^-10;
C_2 = 0.991667;
T_inf = 473.15;
T_sur = 673.15;
T = 490.85;
%Setup differential equation
syms T(t);
ode = diff(T,t) == -(T - T_inf + C_1*(T^4 - T_sur^4))/C_2;
cond = T(0) == 298.15;
TSol(t) = dsolve(ode, cond);
Tsol(t)
My setup is based off of MATLAB's documentation for differential equations. Thanks in advance!
3 comentarios
Roger Stafford
el 28 de Feb. de 2018
You should realize that not every possible differential equation is going to be solvable.
Jeremy Rymer
el 28 de Feb. de 2018
Roger Stafford
el 28 de Feb. de 2018
The "error" message you have quoted is simply "Warning: Unable to find explicit solution. Returning implicit solution instead." I assume that the implicit solution was that of 't' expressed as a function of 'T'. You can get that by taking the reciprocal of dT/dt which is dt/dT and solving that differential equation. It would depend on being able to factor the resulting fourth order polynomial denominator in T. However, solving for T in such a function might be difficult indeed, and require the services of 'fzero'.
Respuestas (1)
Star Strider
el 28 de Feb. de 2018
Use a numeric solver, such as ode45.
This works:
%Declare variables
C_1 = 1.27575*10^-10;
C_2 = 0.991667;
T_inf = 473.15;
T_sur = 673.15;
T = 490.85;
%Setup differential equation
syms T(t) t Y
ode = diff(T,t) == -(T - T_inf + C_1*(T^4 - T_sur^4))/C_2;
[DEVF,Subs] = odeToVectorField(ode)
DE = matlabFunction(DEVF, 'Vars',{t,Y})
[t,y] = ode45(DE, [0 10], 298.15);
figure(1)
plot(t, y)
grid
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!