fsolve problem

조회 수: 2 (최근 30일)
Akshayy Garg
Akshayy Garg 2011년 6월 30일
답변: Walter Roberson 2019년 3월 16일
Hi I am having two problems: I--> I used fsolve in two ways. one by declaring the function inside fsolve and second by making a function. Both give different answers. Second method gives complex solution which is not possible. II--> For some equations fsolve is complex answers. Can i by some method limit fsolve to give real solution.

답변 (2개)

Jesús Zambrano
Jesús Zambrano 2019년 3월 16일
편집: Jesús Zambrano 2019년 3월 16일
You can try with the function solve.
For example, to force getting real solutions:
syms x
eqn = x^5 == 3125;
solve(eqn, x) % gives all the solutions
solve(eqn, x, 'Real', true) % for ce to give the real solutions
  댓글 수: 2
madhan ravi
madhan ravi 2019년 3월 16일
but solve() is used in the answer
Jesús Zambrano
Jesús Zambrano 2019년 3월 16일
I meant: function solve.

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


Walter Roberson
Walter Roberson 2019년 3월 16일
It is not possible to set bounds for fsolve() . You can set the FunValCheck option for fsolve() to tell it to check each iteration for nan and inf and complex values, but that will cause fsolve() to error, not to somehow avoid or work around the problem.
If you just happened to be working with a single function with a single variable, then fzero() permits a range to be passed for x0.
If you have the symbolic toolbox, then vpasolve() permits you to pass bounds for multiple variables.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by