Unable to find explicit solution to differential eq
Show older comments
Hi there!
Pardon me, I'm new to differential equations and particularly in MATLAB, and I have stumbled upon an error that I don't understand the reasoning behind.
I'm getting the error "Warning: Unable to find explicit solution."
kp = 2*10^7;
km = 0.27*10^-4;
syms x(t) x2(t);
ode1 = diff(x,t) == 2*km*x2(t) - 2*kp*x(t)^2;
ode2 = diff(x2,t) == -km*x2(t) + kp*x(t)^2;
odes = [ode1, ode2];
cond1 = x(0) == 10^-9;
cond2 = x2(0) == 0;
conds = [cond1, cond2];
S = dsolve(odes,conds)
It works fine whenever i remove the squaring of x(t) in both differential equations.
Is this caused by some inner workings of the dsolve function?
6 Comments
John D'Errico
on 27 Feb 2019
Edited: John D'Errico
on 27 Feb 2019
And you know that an analytical solution exists? When you remove the squares, the system is now linear, so a solution is trivial.
Torsten
on 27 Feb 2019
Note that
diff(x,t)+2*diff(x2,t)=0,
thus
x(t)+2*x2(t)=x(0)+2*x2(0)=1e-9
and so
x2(t)=5e-10-0.5*x(t).
Insert this expression in one of the differential equation and solve by separation of variables.
Ditlev Bornebusch
on 1 Mar 2019
Edited: Ditlev Bornebusch
on 1 Mar 2019
Mathematica for instance has no issues with this.
I'm willing to bet that you haven't entered the same ODE in both Matlab and Mathematica. As a test, you could take the solution returned by Mathematica and plug it into the ODE as implemented in Matlab to see if the equations (as implemented in Matlab) are satisfied.
Walter Roberson
on 1 Mar 2019
Remember that Mathematics converts floating point constants a different way that MATLAB does.
Walter Roberson
on 2 Mar 2019
If you switch the numeric values into symbolic constants then it turns out there is a series of four analytic solutions.... that are quite long. Roots of a quartic are involved, multiple times. One of the shorter ways to write the expressions involve tanh(); it is also possible to rewrite the tanh() in terms of log() of a complex (and complicated) expression. Or you can rewrite in terms of exponentials, but that gets rather long. I gave up trying to simplfy the expressions.
I suspect that if you were processing the same expressions that Mathematica would probably be willing to produce an answer, but that the answer would not be simple at all.
These kinds of systems are beyond the abilities of MATLAB.
Accepted Answer
More Answers (0)
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!