Dsolve giving implicit solution

조회 수: 11 (최근 30일)
Shahsank pandey
Shahsank pandey 2020년 10월 1일
댓글: Walter Roberson 2020년 10월 2일
Hello,
I am new to Matlab and am trying to solve a heat transfer problem between two heated bodies. I wrote the commands as below, where A,B,C,D and E are all constant values which are already defined and caluclated. On attempting to solve the diff eqn though I am getting this kind of message. Is there something I am doing wrong or should use a different solver or is there a way to make sense out of the solution. My aim would be to get a plot of T vs t. The Diff eqn itself is not implicit so not sure why the solution is coming out implicit.
>> syms A B C D E T(t);
>> ode = diff(T,t) == B + C - A*(T^4) - D*T;
>> cond = T(0) == 673;
>> Tsol(t) = dsolve(ode,cond)
Warning: Unable to find explicit solution. Returning implicit solution instead.
> In dsolve (line 208)
Tsol(t) =
solve(t + symsum(root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k)*(log(T - 4*B*root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k) - 4*C*root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k) + 3*D*root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k)*T) + 3*log(A) + log(root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k)) + log(12*D*root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k) + 4) + pi*1i), k, 1, 4) - symsum(root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k)*(log(2019*D*root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k) - 4*C*root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k) - 4*B*root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k) + 673) + 3*log(A) + log(root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k)) + log(12*D*root(8*D*b + 18*D^2*b^2 - 27*D^4*b^4 - 256*A*B^3*b^4 - 256*A*C^3*b^4 - 768*A*B*C^2*b^4 - 768*A*B^2*C*b^4 + 1, b, k) + 4) + pi*1i), k, 1, 4) == 0, T)
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 10월 2일
Which release are you using? R2020a is returning empty for me.
Walter Roberson
Walter Roberson 2020년 10월 2일
I do not recall ever having seen solve() introduce a variable named b . Especially not within root() -- the variable that it takes the root() of is almost always z, except in cases where z already occurs inside the expression, in which case root() uses numbered z variables such as z1 .... At least in my experience.

댓글을 달려면 로그인하십시오.

채택된 답변

Alan Stevens
Alan Stevens 2020년 10월 1일
편집: Alan Stevens 2020년 10월 1일
Look at documentation on ode45. You don't need a symbolic solution if you just want to get T as a function of t.
Like the following, for example:
tspan = [0 1]; % replace the 1 with your desired end time
T0 = 673;
[t, T] = ode45(@dTdtfn, tspan, T0);
plot(t,T),grid
xlabel('time'),ylabel('Temperature')
function dTdt = dTdtfn(~,T)
% Define A B C and D
A = 10^-6; B = 1; C = 1; D = 10^-2; % Replace with your values
dTdt = B + C - A*(T^4) - D*T;
end
  댓글 수: 1
Shahsank pandey
Shahsank pandey 2020년 10월 2일
Voila! that works. Thank you for the help and direction

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by