Optimize A Variable Given an Initial Guess

조회 수: 5 (최근 30일)
Kohen Bauer
Kohen Bauer 2015년 10월 8일
답변: Walter Roberson 2015년 10월 9일
I have an equation on which I would like to optimize a variable, C53.
guess1 = (R52.*C53)./(A.*C52) % R52,A,C52 and C53 are all vectors, where C53 is my initial guess.
estimate1 = -(sum(guess1);
for i = 2:101
estimate1 = estimate1(i-1) + guess1 %modify the estimate
C53 = C53 + estimate1 %alter the initial guess
end
I implement this block of code multiple times each time using my new C53.
Each time I calculate the difference between my evolving guesses.
abs(diff(guess2-guess1)
However these values are getting larger and hence my answer is not converging. Is there a much more simple way to do this?

답변 (1개)

Walter Roberson
Walter Roberson 2015년 10월 9일
I do not know what your code is doing, but I speculate that you want
guess1 = (R52.*C53)./(A.*C52) % R52,A,C52 and C53 are all vectors, where C53 is my initial guess.
estimate1 = -(sum(guess1);
for i = 2:101
estimate1(i) = estimate1(i-1) + guess1(i); %modify the estimate
end
C53 = C53 + estimate1 %alter the initial guess

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by