Solving multiple independent non linear equations

3 visualizaciones (últimos 30 días)
Haggai
Haggai el 13 de Feb. de 2014
Respondida: Alan Weiss el 26 de Feb. de 2014
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.

Respuestas (1)

Alan Weiss
Alan Weiss el 26 de Feb. de 2014
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

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by