Optimize A Variable Given an Initial Guess
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Antworten (1)
Walter Roberson
am 9 Okt. 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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Systems of Nonlinear Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!