Which documentation and example can I use for iterative solution.

2 次查看(过去 30 天)
Dear expert,
I was struglling with my matlab model. I have a cascade of functions which each set of function recieves the outputs of the other function as an input arguments. To run all these cascaded functions, the first set of functions needs guess values. The outputs of this functions set should be used as inputs for the next set of functions and continue like this untill the final part. Then the outputs of the last set of functions should be the same with guessed values in the begining using iterative approach. This will be the solution of my model. However, I don't know how to make an iterative solution for this problem which will stop iterating when the guess value is equal to the final calculated value (the difference between them converges to zero).
Can someone help me with examples or which documentation can I use, please? I thank you a lot in advance.
N.B I can share codes but it is too much for help.
  12 个评论
Torsten
Torsten 2023-1-12
编辑:Torsten 2023-1-12
It's not unusual that you get different results from "fsolve" if you use different initial guesses for the solution.
In the list of return parameters, you should check "exitflag" and "fval" to get an idea of whether "fsolve" succeeded or not.
Since "fsolve" wants to make the residuals equal to 0, it's not necessary to square y(1:3) - Cp_guess(1:3) elementwise. Just use
sol = Cp_calc(1:3) - Cp_guess(1:3)
Tadele
Tadele 2023-1-12
编辑:Tadele 2023-1-12
That is a very good point. I will check the return parameters. I will also use just y(1:3) - Cp_guess(1:3) without squaring.
Thank you very much, Torsten. It helps me a lot.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver 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