Matlab says solutions are only valid under certain conditions, but when I set ReturnConditions as true, cannot find any solutions. What can I do?
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a system of 12 differential equations and I am trying to find the fixed points using the solve function.
When I run my program, it gives me 130 solutions, but it says:
"Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'."
But when I specify ReturnConditions as true, it says:
"Warning: Unable to find explicit solution. For options, see help."
What can I do to see the conditions? Or can I see which of my 130 solutions are valid without any conditions?
Thanks!
My code for reference:
clear x1 x2 x3 x4 x5 x6 r1 r2 r3 r4 r5 r6 f1 f2 f3 f4 f5 f6 c p alpha beta b
syms x1 x2 x3 x4 x5 x6 r1 r2 r3 r4 r5 r6 f1 f2 f3 f4 f5 f6 c p alpha beta b %all symbols
%now define the ODEs
x1dot = f1*x1 - p*x1*(r1 + beta*r2 + beta*r5);
x2dot = f2*x2 - p*x2*(r2);
x3dot = f3*x3 - p*x3*(r3 + beta*r2);
x4dot = f4*x4 - p*x4*(beta*r2 + r4 + beta*r5);
x5dot = f5*x5 - p*x5*(r5);
x6dot = f6*x6 - p*x6*(beta*r5 + r6);
r1dot = c*(x1*r1/(r1+alpha*r2+alpha*r5)) - b*r1;
r2dot = c*((alpha*x1*r2/(r1+alpha*r2+alpha*r5)) + x2 + (alpha*x3*r2/(r3+alpha*r2)) + (alpha*x4*r2/(alpha*r2+r4+alpha*r5))) - b*r2;
r3dot = c*((x3*r3/(alpha*r2+r3))) - b*r3;
r4dot = c*(x4*r4/(r4+alpha*r2+alpha*r5)) - b*r4;
r5dot = c*((alpha*x1*r5/(r1+alpha*r2+alpha*r5)) + (alpha*x4*r5/(alpha*r2+r4+alpha*r5)) + x5 + (alpha*x6*r5/(alpha*r5+r6))) - b*r5;
r6dot = c*(x6*r6/(alpha*r5+r6)) - b*r6;
%define system of ODEs as the function
fun = [x1dot, x2dot, x3dot, x4dot, x5dot, x6dot, r1dot, r2dot, r3dot, r4dot, r5dot, r6dot];
%To compute the fixed points, solve function == 0
S = solve(x1dot == 0, x2dot == 0, x3dot == 0, x4dot == 0, x5dot == 0, x6dot == 0, r1dot == 0, r2dot == 0, r3dot == 0, r4dot == 0, r5dot == 0, r6dot == 0, 'ReturnConditions',true);
4 Kommentare
Walter Roberson
am 3 Aug. 2020
Bearbeitet: Walter Roberson
am 3 Aug. 2020
When you do not use returnconditions, true, then MATLAB sees divisions in the solution and cannot prove that the denominators cannot be zero, so it gives the warning about there being conditions under which it is true.
When you do use returnconditions, you are asking MATLAB for details on what a closed form solution would look conditionally look like, what exact set of conditions would be needed for a closed form solution. If it cannot find the details, then it gives up instead of presenting what it can find together with some "I do not know what the conditions for this situation are"
Another thing to keep in mind is that you are asking for 12 equations to be solved for 24 variables. MATLAB is going to choose which 12 variables it is going to try to solve for, and that set is not necessarily going to be the set that is solvable. You should explicitly indicate which variables you want to solve for.
Walter Roberson
am 3 Aug. 2020
When you explicitly ask to solve for x1 to x6 and r1 to r6, then it returns 118 solutions.
You could probably do a bit better if you could put restrictions (assumptions) on variables. In particular, if you can tell it that c, p, and beta are non-zero.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Equation Solving finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!