Is it possible to use "fsolve" function by using matrix inputs in order to solve the system of nonlinear equations ?

2 visualizaciones (últimos 30 días)
For example,
function F=myfun(x,A,B,C) {...} end
x0, A, B, C are all matrix inputs
Thank you,
  4 comentarios
John D'Errico
John D'Errico el 13 de Oct. de 2015
A multi-dimensional matrix usually IS of type double. However, nothing stops you from creating matrices of type uint8. fsolve cannot work with those type matrices. So you need to cast the result to doubles.
Note that often, working with integer matrices in your computations means that the computations will be quantized internally. This will make your objective function non-differentiable, so fsolve will still fail. Your objective must be differentiable, so a tiny increment in the parameters MUST result in a non-zero increment in the objective. Otherwise, fsolve will terminate immediately, since it will see a zero gradient vector.
Torsten
Torsten el 13 de Oct. de 2015
Maybe you work with symbolic matrices ? This is not allowed in fsolve...
Best wishes
Torsten.

Iniciar sesión para comentar.

Respuestas (2)

Star Strider
Star Strider el 13 de Oct. de 2015
What, exactly, do you want to solve?
If you have a nonlinear function of several independent variables, and you want to fit that function to data, the lsqcurvefit function might be most appropriate.
  2 comentarios
END
END el 13 de Oct. de 2015
There are 2 nonlinear equations and 2 unknowns, but the parameters used in the equations are all multidimensional matrices. Consider 3D matrices as inputs
Thank you for your help
Star Strider
Star Strider el 13 de Oct. de 2015
I don’t have a clear idea what you want to do, but you would probably have to write a function that used each ‘page’ of your 3D matrices as individual 2D matrices, since matrix operations (to the best of my knowledge) are only defined for 2D matrices.

Iniciar sesión para comentar.


Rik Hati
Rik Hati el 31 de En. de 2019
Hello ! Did you get the solution ? I am stucked in the same probem .

Categorías

Más información sobre Systems of Nonlinear Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by