How to reduce function evaluation in each iteration in fsolve?

1 回表示 (過去 30 日間)
Mohmmad Teymouri
Mohmmad Teymouri 2015 年 10 月 4 日
コメント済み: Mohmmad Teymouri 2015 年 10 月 6 日
Hello, I have a code which contains non-linear equations. I want to solve it using fsolve and it goes very well. But the problem is that function evaluations in each iteration is so time consuming (115 func-count in each iteration). I want to reduce function evaluations in each iteration. Is there any way or code to do it? Or how can I optimize my codes to lower the execution time. Now the running time using tic-toc is 9.5 seconds. I need it to be lower than 0.5 second. With best regards
  2 件のコメント
Jan
Jan 2015 年 10 月 4 日
What about posting the code? Perhaps it is possible to accelerate the function evaluations instead of reducing the number of evaluations.
Mohmmad Teymouri
Mohmmad Teymouri 2015 年 10 月 6 日
I am not pretty sure that my codes are easily readable. But in case you send me your email address I will send them to you. I am sure there is a way to reduce the run time.

サインインしてコメントする。

採用された回答

Eng. Fredius Magige
Eng. Fredius Magige 2015 年 10 月 4 日
You might use vectorization instead of for if is use
  1 件のコメント
Mohmmad Teymouri
Mohmmad Teymouri 2015 年 10 月 6 日
The "for" loops I have used in my codes are somehow complicated. I'm not sure how can I replace vectors instead of "for". I know it is possible and may be easy for a professional programmer but I am new in MATLAB and coding, so it takes a long time for me to do it. Although by a little help and guidance I can change my codes.
I have used Globals in my previous codes. I changed them to class data and also changed else if into elseif and I could reduce the run time from 9.5 seconds to about 5.5 seconds. But it is still too much for my work. I need it to be less than 0.5 seconds. I don't know what can I do?!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by