Warning: Explicit solution could not be found./ empty sym
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hi i get an error on the last line with this program:'Warning: Explicit solution could not be found.',' empty sym', i already tried to adjust the constraints but to na avail...there is a warning included as well in this exercise :Warning: Solutions are valid under the following conditions: e + m ~= 0. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.... i did not succeed in including this...this is the code:
clear all
syms e P S A t m V0 t0 V(t) real
IC = V(t0)==10
diffeq = diff(V,t) == P + e*V(t) - m*(S-(V(t)))
Vsol = simplify(dsolve([diffeq,IC],symvar(V(t))))
V0val = solve(subs(Vsol,t,t0)==0,V0,e + m == 0)
0 Kommentare
Antworten (1)
John D'Errico
am 8 Okt. 2024
Bearbeitet: John D'Errico
am 8 Okt. 2024
Does an analytical solution exist for EVERY equation you can write down? (No.) Even if such a solution does exist, is it certain that a solver tool will always find one? (Again, no.) Is there a reason why what you wrote failed? Well, yes.
syms e P S A t m V0 t0 real
syms V(t)
I said this the last itme you asked this question. You cannot tell MATLAB that V(t), as an unknown function, is real.
IC = V(t0)==10;
diffeq = diff(V,t) == P + e*V(t) - m*(S-(V(t)));
Vsol = simplify(dsolve([diffeq,IC],symvar(V(t))));
Vsol =
(S*m - P + exp((e + m)*(t - t0))*(P + 10*e + 10*m - S*m))/(e + m)
(Answers is currently broken, so I have displayed the command line results from my own off-line version.)
So a solution does exist for the differential equation. It is in the case of solve where it fails.
Now, what does the constraint mean, that e+m must not be zero? THINK. Does that solution for Vsol have a divide by the expression e+m? What happens when e+m == 0? The result is a divide by 0, an operation with no well defined answer, especially when the numerator may also be zero too.
So telling solve to solve for the problem where e+m==0 is just completely meaningless. Again, look at what you are doing.
For e+m NOT equal to zero, when t == t0, what happens? Paper and pencil would suffice, but this is a MATLAB forum, so...
V0 = subs(Vsol,t,t0)
V0 =
(10*e + 10*m)/(e + m)
simplify(V0)
ans =
10
Therefore, V(t0) == V0 = 10.
And again, this is valid ONLY when e+m~=0. When the sum is zero, then potentially, no solution exists, since we would have 0/0. However, you could talk about the limit. And that should exist in this specific case. I'll take the limit as e approaches -m.
limit(v0,e,-m)
ans =
10
2 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!