Test program with the RT black boxes

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LinearCharacteristics.cpp Source File

LinearCharacteristics.cpp

00001 #include "LinearCharacteristics.h"
00002 
00003 using namespace std;
00004 
00005 LinearCharacteristics::LinearCharacteristics(float gain,float offset){    // standard lin characteristics
00006     this->gain = gain;
00007     this->offset = offset;
00008 }
00009 
00010 LinearCharacteristics::LinearCharacteristics(float xmin,float xmax, float ymin, float ymax){    // standard lin characteristics
00011     this->gain = (ymax - ymin)/(xmax - xmin);
00012     this->offset = xmax - ymax/this->gain;
00013 }
00014 
00015 LinearCharacteristics::~LinearCharacteristics() {}
00016 
00017 
00018 float LinearCharacteristics::evaluate(float x)
00019 {   
00020 return this->gain*(x - this->offset);
00021     }