if f2<f1 && f2<f3, xoptold = x2; end
You only set xtoptold if that condition is true, but later you use it even if the condition was false
if f2<f1 && f2<f3, xoptold = x2; end
You only set xtoptold if that condition is true, but later you use it even if the condition was false
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!