看板 MATLAB 關於我們 聯絡資訊
我再用fmincon寫一個最佳化的程式 equality限制式: A = eye(4); b = [(0|3); (0|3); (0|3); (0|3)]; 目的是要讓求出來的值不是零就是三 其他不等式的限制式就不寫了 tou = [4 1 1 2]; f = @(x)(x(1).*tou(1)+x(2).*tou(2)+x(3).*tou(3)+x(4).*tou(4)); options = optimset('LargeScale','on'); [x, fval] = fmincon(f,x0,A,b,Aeq,beq,lb,ub,[], options); 可是最後x求出來的結果卻不是我想要的 請問要怎麼解決呢~? 謝謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.163.16
Gwaewluin:因為你打0|3會算出來1吧,讓b變成[1;1;1;1]了 02/27 11:45