0

我根据系数的合法域值在函数中使用下限和上限fminbnd,如下所示:

[x,fval,exitflag] = fminbnd(@(x) minimize_me(sill, x(1), x(2), x(3), cov), [x1l x2l x3l], [x1u x2u x3u], opts);

其中[x1l x2l x3l][x1u x2u x3u]是表示优化系数下限和上限的向量。我的问题的领域如下:

0<=x1l<=5
0<=x1u<=5

0<=x2l<=5
0<=x2u<=5

0<=x3l<=180
0<=x3u<=180

奇怪的问题是,即使在我的域中选择一些值,我也会收到如下所示的错误:

??? Error using ==> mtimes
Inner matrix dimensions must agree.

Error in ==> fminbnd at 271
    x = xf + si * max( abs(d), tol1 );

例如,如果我选择,我会收到错误:

[x1l x2l x3l], [x1u x2u x3u] = [0 0 0], [5 5 180][x1l x2l x3l], [x1u x2u x3u] = [1 1 0], [5 5 180][x1l x2l x3l], [x1u x2u x3u] = [1 2 0], [5 5 180]等。

[x1l x2l x3l], [x1u x2u x3u] = [5 5 0], [5 5 180]但是,如果我选择等,我不会收到错误消息[x1l x2l x3l], [x1u x2u x3u] = [3 0 0], [3 5 180]

4

1 回答 1

4

根据文档fminbnd仅适用于将单个标量作为参数的函数。

看一下fminsearchbnd文件交换:

http://www.mathworks.com/matlabcentral/fileexchange/8277-fminsearchbnd

于 2012-11-20T05:13:13.357 回答