Fertig

Dependencies:   mbed

Fork of RT2_P3_students by RT2_P3_students

Committer:
Kiwicjam
Date:
Mon Apr 09 08:04:35 2018 +0000
Revision:
2:d7b497824b17
Parent:
0:78ca29b4c49e
befor import von neuen IFIR und DiffCounter;

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 0:78ca29b4c49e 5 LinearCharacteristics::LinearCharacteristics(float k, float offset){ // standard lin characteristics
Kiwicjam 2:d7b497824b17 6 this->k = k;
Kiwicjam 2:d7b497824b17 7 this->offset = offset;
altb 0:78ca29b4c49e 8
Kiwicjam 2:d7b497824b17 9 }
Kiwicjam 2:d7b497824b17 10
Kiwicjam 2:d7b497824b17 11 LinearCharacteristics::LinearCharacteristics(float x1, float x2, float y1, float y2){ // standard lin characteristics
Kiwicjam 2:d7b497824b17 12 this->k = (y2-y1)/(x2-x1);
Kiwicjam 2:d7b497824b17 13 this->offset = y2-(this->k*x2);
Kiwicjam 2:d7b497824b17 14
altb 0:78ca29b4c49e 15 }
Kiwicjam 2:d7b497824b17 16
Kiwicjam 2:d7b497824b17 17 LinearCharacteristics::~LinearCharacteristics(){
Kiwicjam 2:d7b497824b17 18
Kiwicjam 2:d7b497824b17 19 }
Kiwicjam 2:d7b497824b17 20
Kiwicjam 2:d7b497824b17 21
Kiwicjam 2:d7b497824b17 22 float LinearCharacteristics::calculateValue(float x){
Kiwicjam 2:d7b497824b17 23
Kiwicjam 2:d7b497824b17 24 return this->k * x + this->offset;
Kiwicjam 2:d7b497824b17 25
Kiwicjam 2:d7b497824b17 26 }
Kiwicjam 2:d7b497824b17 27