马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
mex文件如下:
void main0(double *input[5],double output[2])
{}
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
double *input[5],*output[2];
int mrows0,ncols0;
...
}
.m文件如下:
clc;
clear;
options=optimset('largescale','off','diagnostics','off','display','iter','tolx',1e-6,'tolfun',1e-6,'MaxFunEvals',500);
input0=[4.0;6.4;3.6;1800;2800];
xiajie=[0.0;0.0;0.0;0.0;0.0];
shangjie=[18;18;18;10000;10000];
mex fourthmex.c
[input,fval,flag,output]=fmincon('dandaofun',input0,[],[],[],[],xiajie,shangjie,[],options);
function [overloading,range]=dandaofun(input);
[overloading,range]=fourthmex(input);
出来的结果是:
FMINCON cannot continue because user supplied objective function failed with the following error:
Five inputs required.
Error in ==> youhua at 9
[input,fval,flag,output]=fmincon('dandaofun',input0,[],[],[],[],xiajie,shangjie,[],options);
求牛人解答 不胜感激 |