Help on error while trying to solve differential equation

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 个评论

You should realize that not every possible differential equation is going to be solvable.
I am aware of that, but since I was getting errors from MATLAB I am assuming there is an issue with the code or maybe the way MATLAB is handling the way I wrote it.
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'.

请先登录,再进行评论。

回答(1 个)

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

类别

产品

Community Treasure Hunt

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

Start Hunting!

Translated by