How to improve computing time of fsolver()

조회 수: 6 (최근 30일)
Turing Machine
Turing Machine 2021년 7월 12일
댓글: Turing Machine 2021년 7월 13일
I'm solving a system of equations in order to find numerically the steady state of a dynamic system, my system is of around 80 equations and variables. I can get exact analytic solution for around 10 variables, which I use as first guess of the corresponding variables, but for the other variables I do not have a better initial guess than any number between 1 and 100.
I'm trying to solve this system using those initial values using fsolve(), but it takes extremely long. Particularly, the report of the iterations show that the column "f(x)" (which I think is some kind of norm of the function, correct me if I'm wrong) decreases to around 2 fastly, but from then it starts to decrease very very slow, what would you recommend me in such a case? Thanks!

답변 (1개)

Walter Roberson
Walter Roberson 2021년 7월 12일
sometimes (but definitely not always!!) you can get faster resolution by transforming the set of equations into a sum-of-squared-error system. So if before you had
fsolve(@fun, x0)
then instead
SSE = @(x) sum(fun(x).^2)
and now use a minimizer on it. I tend to have a bit better results using fminsearch() -- unless there are constraints, in which case fmincon() may be necessary.
  댓글 수: 1
Turing Machine
Turing Machine 2021년 7월 13일
Thanks for your answer! Indeed my solution is constrained, I'll be checking the fmincon() alternative.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by