mpt_demo_lti2

Purpose

Demonstrates online MPC for LTI system

Syntax

mpt_demo_lti2

Description

Demonstrates online MPC for LTI system.

Example(s)

Example 1

Define an LTI prediction model ../../../fig/mpt/demos/mpt_demo_lti21.png
A = [1 1; 0 1]; B = [1; 0.5];

 lti = LTISystem('A', A, 'B', B); 
 Alternativelly, we can import from state-space objects: 
          s = ss(tf(1, [1 0 0]));  
      
          d = c2d(s, 1);  
      
          lti = LTISystem(d);  
       Define the MPC controller 
 horizon = 5; 

 ctrl = MPCController(lti, horizon); 
 Add state constraints 
 ctrl.model.x.min = [-5; -5]; 

 ctrl.model.x.max = [5; 5]; 
 Add input constraints 
 ctrl.model.u.min = -1; 

 ctrl.model.u.max = 1; 
 Set quadratic state penalty 
 ctrl.model.x.penalty = QuadFunction(eye(2)); 
 Set quadratic input penalty 
 ctrl.model.u.penalty = QuadFunction(1); 
 Obtain the optimal control input for a given initial condition.
 x0 = [-4; 0]; Uonl = ctrl.evaluate(x0)
Uonl =

     1

See Also

mpt_demo_lti1, mpt_demo_lti3, mpt_demo_lti4, mpt_demo_lti5


© 2003-2013 Michal Kvasnica: STU Bratislava, michal.kvasnica@stuba.sk