Hii.I am new to matlab environment. I am unable o find out why I am getting error as" not enough input arguments".

MY code is
xo=0.4;
A=[];
b=[];
Aeq=[];
beq=[];
Q=100;
R=1;
N = 50;
U0= zeros(100,1);
% Umin= -1*ones(100,1);
% Umax=1*ones(100,1);
% U = fmincon(@cost1,U0,A,b,Aeq,beq,Umin,Umax,[],[],N);
x=xo; h = 0.1;
xo=[-0.5,0.5];
options = optimoptions(@fmincon,'Algorithm','sqp');
U = fmincon(@cost1,U0,[],[],[],[],[],[],@confuneq,options);
for k =1:N
S1= F(x(k),U(k));
S2=F(x(k)+0.5*h*S1,U(k));
S3=F(x(k)+0.5*h*S2,U(k));
S4=F(x(k)+h*S3,U(k));
x(k+1) = x(k) + (1/6)* (S1+ 2*S2+ 2*S3 + S4)*h;
k = k + 1 ;
end
% plot(x);
plot(U);
grid on
figure(); plot(x)
grid on

1 Kommentar

YOu have not specified the line number of error..and also the function cost1 is missing.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Model Predictive Control Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 28 Dez. 2016

Kommentiert:

am 28 Dez. 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by