nlmpcmove too many input arguments
7 views (last 30 days)
Show older comments
Massimo Pesavento
on 20 Sep 2021
Answered: Massimo Pesavento
on 21 Sep 2021
Hello, I'm using nlmpc to perform just one prediction step.
I create my nlmpc object like this.
deterministicController = nlmpc(2, 2, 1);
deterministicController.PredictionHorizon = L;
generate a few parameters in a loop and build the prediction models and costs based off of those
deterministicController.Model.StateFcn = @(x,u) epsilons(l) * fNonlinear(x, u, npap) ...
+ (1-epsilons(l)) * fLinear(x, u, npap, xBar);
deterministicController.Model.OutputFcn = @(x,u) x;
deterministicController.Optimization.CustomCostFcn = ...
@(X, U, data) sum( (...
[U(1:data.PredictionHorizon,data.MVIndex(1))'; X(2:data.PredictionHorizon+1,1:2)']...
- zRef) .^2 );
The problem is unconstrained. I then perform just one evaluation with
uStar = nlmpcmove(deterministicController, xm1, um1);
which outputs
Error using nonlinear
Too many input arguments.
Error in znlmpc_getZBounds (line 36)
f1 = hCostFcn(X0, U0, e0, userdata, runtimedata.Parameters{:});
Error in nlmpc/nlmpcmove (line 122)
[zLB, zUB] = znlmpc_getZBounds(coredata, runtimedata, userdata, handles.hCostFcn, z0);
By the way xm1 is 2x1, bm1 is scalar and fLinear, fNonlinear are correct (previously tested, outputting 2x1).
I can provide the rest of the code. Thank you.
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Model Predictive Control Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!