Cuboid
Dependencies: mbed
LinearCharacteristics.cpp@21:cef093edb441, 2018-05-17 (annotated)
- Committer:
- altb
- Date:
- Thu May 17 11:15:36 2018 +0000
- Revision:
- 21:cef093edb441
- Parent:
- 0:15be70d21d7c
- changed LinCharacteristics parametrisation; - changed Prefilter and K-gain according cuboid Lab FS2018
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rtlabor | 0:15be70d21d7c | 1 | #include "LinearCharacteristics.h" |
rtlabor | 0:15be70d21d7c | 2 | |
rtlabor | 0:15be70d21d7c | 3 | using namespace std; |
rtlabor | 0:15be70d21d7c | 4 | |
altb | 21:cef093edb441 | 5 | LinearCharacteristics::LinearCharacteristics(float gain,float offset){ // standard lin characteristics |
altb | 21:cef093edb441 | 6 | this->gain = gain; |
rtlabor | 0:15be70d21d7c | 7 | this->offset = offset; |
altb | 21:cef093edb441 | 8 | } |
altb | 21:cef093edb441 | 9 | |
altb | 21:cef093edb441 | 10 | LinearCharacteristics::LinearCharacteristics(float xmin,float xmax, float ymin, float ymax){ // standard lin characteristics |
altb | 21:cef093edb441 | 11 | this->gain = (ymax - ymin)/(xmax - xmin); |
altb | 21:cef093edb441 | 12 | this->offset = xmax - ymax/this->gain; |
altb | 21:cef093edb441 | 13 | } |
altb | 21:cef093edb441 | 14 | |
altb | 21:cef093edb441 | 15 | LinearCharacteristics::~LinearCharacteristics() {} |
rtlabor | 0:15be70d21d7c | 16 | |
rtlabor | 0:15be70d21d7c | 17 | |
altb | 21:cef093edb441 | 18 | float LinearCharacteristics::evaluate(float x) |
altb | 21:cef093edb441 | 19 | { |
altb | 21:cef093edb441 | 20 | return this->gain*(x - this->offset); |
rtlabor | 0:15be70d21d7c | 21 | } |