[問題] optimization toolbox 範例 問題
我是剛使用matlab的新手 因需要用到非線性最佳化的功能
所以進入 help之中的 Example: Nonlinear Constrained Minimization 去練習
我照著範例的說明一步一步操作
首先 在 command window 輸入 edit rosenbrock
接著打開 edit 複製
function f = rosenbrock(x)
f = 100*(x(2) - x(1)^2)^2 + (1 - x(1))^2;
然後存檔
接著我在打開新的edit 輸入
function [c, ceq] = unitdisk(x)
c = x(1)^2 + x(2)^2 - 1;
ceq = [ ];
然後存檔
接著我按照toolbox的範例指令一項一項輸入
點選了start 卻出現以下的文字敘述:
Error in the following problem input(s):
objective: Error: The input character is not valid in MATLAB statements or
expressions.
我想到的可能原因是我沒有參照step 1 要求我define函數
1.Define your objective function in the MATLAB® language, as a function file
or anonymous function. This example will use a function file.
2.Define your constraint(s) as a separate file or anonymous function.
請問是因為我沒有define才造成這樣的錯誤嗎?
如果是的話可否請問要如何define 我找了好久都沒看到相關的指令教學
謝謝大家幫忙了
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 1.162.59.66
※ 編輯: YOYOISGOOD 來自: 1.162.59.66 (02/21 00:31)
推
02/21 09:39, , 1F
02/21 09:39, 1F
→
02/21 13:34, , 2F
02/21 13:34, 2F
→
02/21 14:27, , 3F
02/21 14:27, 3F