作者YOYOISGOOD (YOYOISGOOD)
看板MATLAB
标题[问题] optimization toolbox 范例 问题
时间Thu Feb 21 00:30:25 2013
我是刚使用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)
1F:推 mailroach:先用f1=@rosenbrock,将f1丢进gui介面,unitdisk同理 02/21 09:39
2F:→ YOYOISGOOD:请问一下什麽是gui介面?? 02/21 13:34
3F:→ mailroach:就是你打optimtool跑出来的东西 02/21 14:27