How to apply a function independently for a set of data?

1 visualización (últimos 30 días)
Benson Gou
Benson Gou el 4 de Jun. de 2021
Comentada: Walter Roberson el 5 de Jun. de 2021
Dear All,
I have a set of data {Ai, bi}, i = 1, ..., N. I want to apply a function which solves Ai(xi) = bi, a nonliear problem. {Ai, bi} is indepentent and has nothing to do with each other for all i. My question is how to apply the function to solve the group together, A = [A1 A2 ... AN], b = [b1, b2, ..., bN]. My goal is to speed up my computation.
The original process is that I repeatly run the function N times to solve Ai(xi)=bi, i = 1, ..., N, where xi is a single variable. Now I want to run the function at one time to solve all Ai(xi)=bi, i=1,...,N, together. My rough idea is to form a matrix A = [A1 A2 ... AN], b = [b1 b2 ... bN], and then run the fucntion one time to solve all xi, i = 1, ..., N. But I am wondering if there is a simpler way to solve all equations together.
Thanks a lot.
Benson
  3 comentarios
Benson Gou
Benson Gou el 5 de Jun. de 2021
Dear dpb,
Thanks a lot for your reply. Please review my submission which was added more details about the my problem. Please let me know if it is clear or not.
Best regards,
Benson
Walter Roberson
Walter Roberson el 5 de Jun. de 2021
Whether your approach would work or not would depend upon the computation involved. In some cases it might be quite efficient to do all of the matrices at the same time; in other cases it might be mathematically difficult to do all of them at the same time. Or it just might not be efficient to solve them all at the same time.
We would need to know more about the computation to advise further.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox 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