Clear Filters
Clear Filters

How can I change multistage nlmpc Solver?

8 views (last 30 days)
William Notaro
William Notaro on 22 Jul 2024
Answered: Samay Sagar on 24 Jul 2024
I am trying to change nlmpcMultistage object solver from 'fmincon' to 'gmres' following this guide: https://www.mathworks.com/help/mpc/ug/control-robot-manipulator-using-cgmres-solver.html
However, I receive the following error:
"Error using nlmpcMultistage/set.Optimization
Invalid field name "Solver" found in the "Optimization" structure."
I also tried a suggestion such as to initialize the object with the Solver argument specified as: nlmpcMultistage(p,nx,'MV',1,'MD',2,'Solver','cgmres');
However I get the following error: Error using nlmpcMultistage
Input channel must be one of the following types: 'MV' (manipulated variable), 'MD' (measured
disturbance), or 'UD' (unmeasured disturbance).
Like the Solver option is not available.
Is there a way to change the solver to cgmres?
Thanks in advance

Answers (1)

Samay Sagar
Samay Sagar on 24 Jul 2024
It appears that the issue you are encountering is due to the version of MATLAB you are using, i.e., R2022b, which does not support the “Solver” property for the “nlmpcMultistage” object. This feature was introduced in MATLAB R2023a, which is why you are seeing errors when trying to set the solver to “cgmres”.
To resolve this issue, I recommend upgrading your MATLAB version to R2023a or later. This will enable you to use the “cgmres” solver as described in the guide you referenced.
If upgrading MATLAB is not an immediate option for you, another approach would be to implement a custom solver. You can refer the following documentation to implement the same:
For more information about “nlmpcMultistage”, you can refer the following documentation:

Categories

Find more on Signal Processing Toolbox in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!