matlab - Why does using `solve` with a multivariate system of equations error unexpectedly? -
matlab - Why does using `solve` with a multivariate system of equations error unexpectedly? -
while trying solve scheme of equations 2 variables , 2 unknowns (izhikevich nullclines), encountered unexpected error: warning: 4 equations in 2 variables.
, warning: explicit solution not found.
this unexpected because stated, providing 2 equations 2 variables, should well-formed scheme of equations.
my relevant lines of code follows:
syms uu vv [solvv, soluu] = solve([0.04*vv^2 + 5*vv + 140 - uu + i(t) == 0, a(t)*(b(t)*vv - uu) == 0], [vv, uu]);
the finish error trace is:
warning: 4 equations in 2 variables. \> in c:\program files\matlab\r2012b\toolbox\symbolic\symbolic\symengine.p>symengine @ 54 in mupadengine.mupadengine>mupadengine.evalin @ 97 in mupadengine.mupadengine>mupadengine.feval @ 150 in solve @ 160 in q3_new @ 37 in run @ 64 warning: explicit solution not found. \> in solve @ 169 in q3_new @ 37 in run @ 64
confused, went matlab's documentation solve
, tried using illustration snippet solving multivariate scheme of equations:
syms u v [solv, solu] = solve([2*u^2 + v^2 == 0, u - v == 1], [v, u])
the expected output of snippet, according documentation, is:
solv = - (2^(1/2)*1i)/3 - 2/3 (2^(1/2)*1i)/3 - 2/3 solu = 1/3 - (2^(1/2)*1i)/3 (2^(1/2)*1i)/3 + 1/3
but snippit instead returns:
warning: 4 equations in 2 variables. \> in c:\program files\matlab\r2012b\toolbox\symbolic\symbolic\symengine.p>symengine @ 54 in mupadengine.mupadengine>mupadengine.evalin @ 97 in mupadengine.mupadengine>mupadengine.feval @ 150 in solve @ 160 warning: explicit solution not found. \> in solve @ 169
solv =
[ empty sym ]
solu =
[]
as before.
now know i'm not making beginner's error code because illustration code errors in same way. calling singlevariate illustration snippit works expected. have tried matlab 2012a , matlab 2014a.
what explain unusual behaviour?
can duplicate on matlab 2014a. found if defined variables using syms
can allow solve
resolve variables automatically.
syms u v [sv, su] = solve([2*u^2 + v^2 == 0, u - v == 1], [v, u]) % doesn't work % works order-unspecified not desirable [su, sv] = solve([2*u^2 + v^2 == 0, u - v == 1])
another user points out error in using wrong documentation. matlab 2014a uses next notation instead re-ordered solutions. other form seems 2015. should verify holds true in 2012a seems so
syms u v [sv, su] = solve([2*u^2 + v^2 == 0, u - v == 1], v, u)
matlab solver
Comments
Post a Comment