Fertig

Dependencies:   mbed

Fork of RT2_P3_students by RT2_P3_students

Committer:
altb
Date:
Mon Apr 09 08:01:29 2018 +0000
Revision:
3:769ce5f06d3e
Parent:
0:78ca29b4c49e
Child:
6:2cc56521aa16
Changes from pmic

Who changed what in which revision?

UserRevisionLine numberNew contents of line
altb 0:78ca29b4c49e 1 #include "LinearCharacteristics.h"
altb 0:78ca29b4c49e 2
altb 0:78ca29b4c49e 3 using namespace std;
altb 0:78ca29b4c49e 4
altb 3:769ce5f06d3e 5 LinearCharacteristics::LinearCharacteristics(float g, float o){ // standard lin characteristics
altb 3:769ce5f06d3e 6 this->gain = g;
altb 3:769ce5f06d3e 7 this->offset = o;
altb 0:78ca29b4c49e 8 // ...
altb 0:78ca29b4c49e 9 }
altb 3:769ce5f06d3e 10 LinearCharacteristics::LinearCharacteristics(float x_min, float x_max, float y_min, float y_max){ // standard lin characteristics
altb 3:769ce5f06d3e 11 this->gain = (y_max-y_min)/(x_max-x_min);
altb 3:769ce5f06d3e 12 this->offset = x_max - y_max/this->gain;
altb 3:769ce5f06d3e 13
altb 3:769ce5f06d3e 14
altb 3:769ce5f06d3e 15 }
altb 3:769ce5f06d3e 16
altb 3:769ce5f06d3e 17 LinearCharacteristics::~LinearCharacteristics() {}
altb 3:769ce5f06d3e 18
altb 3:769ce5f06d3e 19
altb 3:769ce5f06d3e 20 float LinearCharacteristics::eval(float x){
altb 3:769ce5f06d3e 21
altb 3:769ce5f06d3e 22 return (gain * (x-offset));
altb 3:769ce5f06d3e 23
altb 3:769ce5f06d3e 24 }