-
Notifications
You must be signed in to change notification settings - Fork 2
/
EU.cpp
39 lines (33 loc) · 720 Bytes
/
EU.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "EU.h"
#include "MatrixCalc.h"
namespace ADP{
void EU::linear(const std::vector<double>& x, Controllers* controller, inputfun input, const double t)
{
if (controller!=nullptr)
{
std::vector<double> u = controller->input(x,mdt,t);
mu = u;
mx = (x+mdt*vec(mA * x + mB * u));
}
else if (input!=nullptr)
{
std::vector<double> u = input(x,mB.size()[0],t);
mu = u;
mx = (x+mdt*vec(mA * x + mB * u));
}
else
mx = (x+mdt*vec(mA * x));
}
void EU::dispAll() const
{
std::cout << "mA is";
disp(mA);
std::cout << "mB is";
disp(mB);
std::cout << "mx is";
disp(mx);
std::cout << "mu is";
disp(mu);
std::cout << "mdt is " << mdt << std::endl;
}
}