plot

Class method.

plot(self, *args, **kwargs)

Plot the results of the MPC simulation.

If no argument is passed, by default the closed loop states and controls are plotted seperated in two subplots.

If only a specific component of the solution should be plotted, this can be customized by using a string as the first argument. Valid arguments for this are

  • state for only plotting the closed loop state trajectories

  • control for only plotting the closed loop control values

  • cost for plotting the stage costs evaluated at the closed loop results

  • phase for plotting a phase portrait of two components of the solution.

Further adjustments can be made with the help of the following keyword arguments.

Argument

Description

Default value

xk

List specifying which components of the state

are plotted.

[1,…,nx]

uk

List specifying which components of the control

are plotted.

[1,…,nu]

show_ol

If True, the open loop simulation rersults are

also plotted additionaly to the closed loop

results.

True

iters

List indicating from which iteration on the open

loop results should be plotted.

Will be ignored if show_ol is False.

[1,…,K+1]

usetex

If True, the captions are displayed in TEX style.

True

grid

If True, a grid is displayed in the background

of the plot.

True

show_legend

If True, a legend will be displayed inside

the plot.

True

phase1

Phase 1 of the phase portrait plot.

Has the form x_k or u_k, where k determines

the respective component.

Will be ignored if args!=’phase’.

None

phase2

Phase 2 of the phase portrait plot.

Has the form x_k or u_k, where k determines

the respective component.

Will be ignored if args!=’phase’.

None

dpi

resolution of the figure, see

100

figsize

The size of the figure.

Has the form [width, height] in inches.

[8., 6.]

linewidth

Set the line width in points.

fontsize

The font size of the annotations.

If the value is numeric the size will be the

absolute font size in points.