Optimize A Variable Given an Initial Guess

2 vues (au cours des 30 derniers jours)
Kohen Bauer
Kohen Bauer le 8 Oct 2015
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?

Réponses (1)

Walter Roberson
Walter Roberson le 9 Oct 2015
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

Community Treasure Hunt

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

Start Hunting!

Translated by