root/library/tests/LQG_test.cpp @ 588

Revision 588, 0.5 kB (checked in by smidl, 15 years ago)

win32 compilation fixes

Line 
1#define BDMLIB
2#include "UnitTest++.h"
3#include "design/ctrlbase.h"
4
5using namespace bdm;
6
7TEST(test_LQG) {
8        LQG reg;
9        shared_ptr<StateSpace<fsqmat> > stsp=new StateSpace<fsqmat>;
10        // 2 x 1 x 1
11        stsp-> set_parameters(eye(2), ones(2,1), ones(1,2), ones(1,1), /* Q,R */ eye(2), eye(1));
12        reg.set_system(stsp); // A, B, C
13        reg.set_control_parameters(eye(1), eye(1),  vec_1(1.0), 6); //Qy, Qu, horizon
14
15        reg.redesign();
16        double reg_apply=reg.apply("0.5, 1.1","0.0")(0); /*convert vec to double*/
17        CHECK_CLOSE(reg_apply, -0.248528137234392, 0.0001);
18}
Note: See TracBrowser for help on using the browser.