matlab矩阵维度不允许,matlab编程中出现问题,说是矩阵维度不一致 ,

matlab编程中出现问题,说是矩阵维度不一致 ,

matlab编程中出现问题,说是矩阵维度不一致 ,

M文件主函数如下:function f=myobj(x)

arf=linspace(0.0001,0.5233,100);

K=1162;M=600;L=1650;

t=281-x(1).*cos(arf+1.134);

h=sqrt(x(2).^2-(x(1).*sin(1.134+arf)-x(3)).^2);

s=t-h;

f=abs(acot(cot(arf)-K/L)-1.134+acos((x(1).^2+(562+s).^2+x(3).^2-x(2).^2)./(2.*x(1).*(562+s).^2+x(3).^2))-atan(2.*x(3)/(562+2.*s)));

然后命令窗口中运行出现问题了:>> A=[];b=[];Aeq=[];beq=[];

>> lb=[100,231,30]

lb =

100 231 30

>> ub=[148,258,107]

ub =

148 258 107

>> x0=[0 0 0 ]

x0 =

0 0 0

>> options=optimset('LargeScale','off','display','iter');

>> [x,fval,exitflag]=fmincon(@myobj,x0,A,b,[],[],lb,ub,@mycon,options)

Error using ==> fmincon

FMINCON cannot continue because user supplied objective function failed with the following error:

Error using ==> mrdivide

Matrix dimensions must agree.

>> [x,fval]=fmincon(@myobj,x0,A,b,[],[],lb,ub,@mycon,options)

Error using ==> fmincon

FMINCON cannot continue because user supplied objective function failed with the following error:

Error using ==> mrdivide

Matrix dimensions must agree.

1年前

悬赏10滴雨露 已收到1个回答

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值