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

3 次查看(过去 30 天)
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 个评论
Benson Gou
Benson Gou 2021-6-5
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 2021-6-5
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by