Not enough input arguments
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everybody, I am new to Matlab. I try running this example but I seem to run a problem that says not enough input arguments. here is the code. Anyone pls tell me which one I need to change to implement this. Thanks!
function J = cost_function(u)
u0 = u(1);
u1 = u(2);
u2 = u(3);
u3 = u(4);
u4 = u(5);
c = [1 0];
z1 = [0 0.4;-3.92 1.2];
z2 = [0;0.2];
x0 = [0;0];
x1 = z1*x0 + z2*u0;
x2 = z1^2*x0 + z1*z2*u0 + z2*u1;
x3 = z1^3*x0 + z1^2*z2*u0 + z1*z2*u1 + z2*u2;
x4 = z1^4*x0 + z1^3*z2*u0 + z1^2*z2*u1 + z1*z2*u2 + z2*u3;
x5 = z1^5*x0 + z1^4*z2*u0 + z1^3*z2*u1 + z1^2*z2*u2 + z1*z2*u3 + z2*u4;
J = (0.1-c*x0)^2 + (0.1-c*x1)^2 + (0.1-c*x2)^2 + (0.1-c*x3)^2 + (0.1-c*x4)^2
0 Kommentare
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!