필터 지우기
필터 지우기

Solving an algebraic loop / iterative loop in MATLAB

조회 수: 6 (최근 30일)
Thomas Ewald
Thomas Ewald 2020년 6월 22일
댓글: Thomas Ewald 2020년 6월 23일
Hello everyone!
I have the following problem: I have an iteration loop, that has to converge to a certain value of a vector x, where during the loop the iteration is calulated directly from with a nonlinear function f. At some point is fulfilled (the "distance" between both vectors is smaller than a predefined tolerance value) and the iterations can stop.
I found, that in Simulink this would be called an "algebraic loop" and that simulink can solve this (i also made use of that in the past). The thing now is, that i have this in a matlab code. For now, this is solved with a self-made variable gain controller and a feedback loop.
I was wondering, if there is some way to solve this with matlab onboard tools. In most cases i think that onboard tools are more reliable and faster than self-coded stuff is. I am looking for something like
x = iterate(@f,x0,opts);
that does this.
Any ideas?
Thanks a lot and best wishes so far
Thomas
  댓글 수: 3
Thomas Ewald
Thomas Ewald 2020년 6월 23일
편집: Thomas Ewald 2020년 6월 23일
Hello,
and thanks for the answer. The problem, as I see it, is that the vector x in the common optimization or search algorithms is varied by the algorithm itself. In my case, I want to vary the vector on my own, with the function I have. So I have basically two outputs ( and ) at the same time. Common algorithms in matlab only take one objective and work on x for themselves.
But the problem of iterating until something converged is not very uncommon, so I think there must be some sort of algorithm in MATLAB to deal with that problem.
Does anybody know how to solve this?
Best
Thomas
Thomas Ewald
Thomas Ewald 2020년 6월 23일
Hello,
I think I found a possible solution. By using the fminunc function, setting SpecifyObjectiveGradient to true and supplying a user defined function to calculate the gradient, I could solve problem.
Maybe this works and is better than the self-made solution.
Thanks a lot and best wishes
Thomas

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by