Template for group 4

Dependencies:   mbed

Fork of RT2_P3_students by RT2_P3_students

Committer:
altb
Date:
Sun Apr 22 19:54:59 2018 +0000
Revision:
7:01a7363583b2
Parent:
5:72982ede2ff6
Child:
10:85840c065e00
P3_2

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 5:72982ede2ff6 5 LinearCharacteristics::LinearCharacteristics(float gain,float offset){ // standard lin characteristics
altb 5:72982ede2ff6 6 this->gain = gain;
altb 5:72982ede2ff6 7 this->offset = offset;
altb 2:769ce5f06d3e 8 }
altb 2:769ce5f06d3e 9
altb 7:01a7363583b2 10 LinearCharacteristics::LinearCharacteristics(float xmin,float xmax, float ymin, float ymax){ // standard lin characteristics
altb 7:01a7363583b2 11 this->gain = (ymax - ymin)/(xmax - xmin);
altb 7:01a7363583b2 12 this->offset = xmax - ymax/this->gain;
altb 7:01a7363583b2 13 }
altb 7:01a7363583b2 14
altb 2:769ce5f06d3e 15 LinearCharacteristics::~LinearCharacteristics() {}
altb 2:769ce5f06d3e 16
altb 5:72982ede2ff6 17
altb 5:72982ede2ff6 18 float LinearCharacteristics::evaluate(float x)
altb 5:72982ede2ff6 19 {
altb 5:72982ede2ff6 20 return this->gain*(x - this->offset);
altb 5:72982ede2ff6 21 }