How to use fsolve solution as its initial values for the next step size

Hi, I want to solve a system of nonlinear equations (having sine and cosine) inside a user-defined function in Simulink. It works well. However, the initial values I gave the solver for t=0 is no longer a good guess for the next step size of running the program. So my question is, how can I give the solver initial values equal to the solution for the previous step? Of course, at t=0, I have already set a vector of constant initial conditions. Note that if I connect the output of the block (solution of fsolve) as an input to the block (to be used as initial values for fsolve inside the block), there will be algebraic loop problem; consequently, the program stops. Any idea?

Antworten (1)

Walter Roberson
Walter Roberson am 5 Mai 2018

4 Kommentare

Thanks Walter. It is giving unreasonable results. My system is large; any delay as a loop break affects the whole results. I have also tried other options in the link and more.
As it is a user-defined function, presumably using a MATLAB Function Block, why not just use a persistent ?
Thanks. Yes, it is a MATLAB Function block. But sorry, I didn't get what you mean exactly by your question.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu General Applications finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 4 Mai 2018

Community Treasure Hunt

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

Start Hunting!

Translated by