Error using fmincon (line 300) A must have 3 column(s).
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/06 08:38:45
Error using fmincon (line 300) A must have 3 column(s).
function y =opt_fun1(x)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
y=(x(1)-1)^2+(x(2)-2)^2+(x(3)-3)^2+(x(4)-4)^2
ff=optimset;ff.largerscale='off';ff.display='iter';ff.tolfun=1e-30;ff.tolx=1e-15;
ff.tolcon=1e-20;x0=[1;1;1];A=[1,1,1,1;3,3,2,1;0,0,0,0];B=[5;10];xm=[0,0,0,0];xM=[];Aeq=[];Beq=[];
[x,f_opt,c,d]=fmincon('opt_fun1',x0,A,B,Aeq,Beq,xm,xM,'opt_con1',ff)
function y =opt_fun1(x)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
y=(x(1)-1)^2+(x(2)-2)^2+(x(3)-3)^2+(x(4)-4)^2
ff=optimset;ff.largerscale='off';ff.display='iter';ff.tolfun=1e-30;ff.tolx=1e-15;
ff.tolcon=1e-20;x0=[1;1;1];A=[1,1,1,1;3,3,2,1;0,0,0,0];B=[5;10];xm=[0,0,0,0];xM=[];Aeq=[];Beq=[];
[x,f_opt,c,d]=fmincon('opt_fun1',x0,A,B,Aeq,Beq,xm,xM,'opt_con1',ff)
错误提示说你至少得有3列,而你只有A,B两列?
Error using fmincon (line 300) A must have 3 column(s).
matlab 出错must have 6 column(s).
Error:File:d:\MATLAB7\work\Untitled.m Line:31 Column:7This s
Error:File:D:\matlab\work\Untitled111.m Line:19 Column:3
请问下面的程序有错吗?matlab老是提示Error using stem (line 44) X must be sa
matlab Error using ==> mpower Inputs must be a scalar and a
Error using ==> surf at 78 Z must be a matrix,not a scalar o
一段matlab程序,Error using ==> conv2 A and B must be full double
matlab错误 Error using ==> mpower Inputs must be a scalar and
matlab:Error using ==> mtimes Inner matrix dimensions must a
matlab程序问题,Error using ==> mrdivide Matrix dimensions must a
matlab Error using ==> mtimes Inner matrix dimensions must a