Order of solutions with symbolic solver seems to be arbitrary

2 ビュー (過去 30 日間)
Matthew Wade
Matthew Wade 2013 年 6 月 11 日
Hi,
I am using symbolic toolbox to solve a set of 5 equations with 5 variables over a range of input conditions. I have made the assumption that the solutions are real and positive and I get two valid roots. I assign these two solutions to two variables and plot them. The resulting plot is shown below. As can be seen, there is a point where the solutions appear to switch "position", i.e. [x1;x2] becomes [x2;x1] - as I assume the variable does not display the characteristics of the observed curves.
Is there any rule that dictates the order of solutions produced from solve? I have been working with another set of 6 equations and have never seen this switching phenomenon. I need to test the validity of these solutions, so it would be good to understand how solve works when producing output from the solver.
Regards, matt
Code snippet:
eq1_2 = alpha*(uf - s0) - mu0*x0;
eq2_2 = -alpha*x0 + mu0*x0 - A*x0;
eq3_2 = -alpha*s1 + omega1*mu0*x0 - mu1*x1;
eq4_2 = -alpha*x1 + mu1*x1 - B*x1;
eq5_2 = -alpha*s2 + omega2*mu1*x1 - mu0*rho*x0;
solveB=solve(eq1_2,eq2_2,eq3_2,eq4_2,eq5_2,'Real',true);
if ~isempty(solveB)
for k=1:length(solveB.x0)
eval(['S2_xch' num2str(k) '(mm,nn)=vpa(solveB.x0(k));'])
eval(['S2_sch' num2str(k) '(mm,nn)=vpa(solveB.s0(k));'])
eval(['S2_xph' num2str(k) '(mm,nn)=vpa(solveB.x1(k));'])
eval(['S2_sph' num2str(k) '(mm,nn)=vpa(solveB.s1(k));'])
eval(['S2_sh' num2str(k) '(mm,nn)=vpa(solveB.s2(k));'])
end

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 6 月 11 日
In the general case, NO, the solutions do not have any order between themselves, but they will be consistent within the variables (e.g., the third solution for x0 will correspond to the third solution for s2)
I think I have encountered some cases where the solutions were said to be ordered by absolute magnitude, or by phase angle within absolute magnitude.
When I use the 5 equations you give, and solve for x0, s0, x1, s1, s2, then the solution I get is s0 = uf and everything else is 0.
  1 件のコメント
Matthew Wade
Matthew Wade 2013 年 6 月 12 日
Thanks Walter,
I noticed the order is consistent across variables, but there is certainly no logic to that order, sometimes I get [highest lowest] and other times [lowest highest] as can be seen in the plot.
The solutions you found are incorrect as mu0 and mu1 are also functions of s0, s1 and s2.
regards matt

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by