Solving multiple independent non linear equations

조회 수: 3 (최근 30일)
Haggai
Haggai 2014년 2월 13일
답변: Alan Weiss 2014년 2월 26일
Hi,
I have a large number (order of 1 Milion) of non linear equations that I want to solve simultaneously.
The equations are of the form
func(x)-(a_i*x+b_i)==0
Where func is some non linear function like sin(x) (for example) and a_i, b_i are given - these equations just calculate the intersection point of some non linear function of x with many linear functions. Note that the variable x is not the same in all equations - the equations are independent. I can provide a good approximation to the solution which can be used for initializing some algorithm.
I took a look on the documentation of fzero or fsolve but I am not sure I can use them.
My current approach is to calculate second order Taylor approximations of func and intersect the linear functions with them, but I think that this is not fast, not accurate and not elegant.
Does anybody know how to do this?
Thanks
H.

답변 (1개)

Alan Weiss
Alan Weiss 2014년 2월 26일
I can think of two ways:
  1. Use fzero in a loop, solving one component at a time.
  2. Use fsolve with the following options:
'Algorithm' = 'trust-region-reflective'
'JacobPattern' = speye(n) % , where n is the number of equations you have
'PrecondBandWidth' = 0
Alan Weiss
MATLAB mathematical toolbox documentation

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by