Optimize A Variable Given an Initial Guess
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Nonlinear Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!