Equation solver nonlinear variables

조회 수: 5 (최근 30일)
K.G
K.G 2019년 8월 14일
댓글: Walter Roberson 2019년 8월 17일
Good day, I have a set of 30 non-linear first-order equations and want to solve for them. First I tried fsolve but I don't want to have any complex or negative roots. So I tried "isqnonlin". Is there any better equation solver I could try?
Thank you in advance,
  댓글 수: 2
John D'Errico
John D'Errico 2019년 8월 14일
What is a nonlinear first order equation? Nonlinear and first order seem a bit contradictory.
Anyway, fsolve does not generate complex roots, unless your variables have things in them like logs or fractional powers, whereupon there will be issues when the solver tries to wander into the bad place. Those issues are created because really, you want a constrained solution. But fsolve does not offer constraints.
Lsqnonlin can help, in the sense that it does allow bounds, so IF your problem is sufficiently simple that bounds will prevent the solver from looking in a bad place, then it will be happy.
K.G
K.G 2019년 8월 17일
my euqations are non-linear, and I tried to re-write the equations without using log or sqrt. they are in this form: x^2 + y = z^2 but still get complex roots. How can I make it simpler than this?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2019년 8월 14일
vpasolve permits you to specify ranges for each variable.
  댓글 수: 2
K.G
K.G 2019년 8월 17일
the problem with vpasolve is that it is not defined to take function-handle type. it onlt works for single variables.
Walter Roberson
Walter Roberson 2019년 8월 17일
>> f = @(x,y) x.^2 - 5*y + 2
f =
function_handle with value:
@(x,y)x.^2-5*y+2
>> syms x y
>> vpasolve(f(x,y))
ans =
struct with fields:
x: [1×1 sym]
y: [1×1 sym]

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by