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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Benson Gou
Benson Gou il 5 Giu 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 il 5 Giu 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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by