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

1 view (last 30 days)
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 Comments
Benson Gou
Benson Gou on 5 Jun 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 on 5 Jun 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.

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!