Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
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 this->ulim = 999999.0; 00009 this->llim = -999999.0; 00010 } 00011 00012 LinearCharacteristics::LinearCharacteristics(float xmin,float xmax, float ymin, float ymax){ // standard lin characteristics 00013 this->gain = (ymax - ymin)/(xmax - xmin); 00014 this->offset = xmax - ymax/this->gain; 00015 this->ulim = 999999.0; 00016 this->llim = -999999.0; 00017 00018 } 00019 LinearCharacteristics::LinearCharacteristics(float xmin,float xmax, float ymin, float ymax,float ll, float ul){ // standard lin characteristics 00020 this->gain = (ymax - ymin)/(xmax - xmin); 00021 this->offset = xmax - ymax/this->gain; 00022 this->llim = ll; 00023 this->ulim = ul; 00024 00025 } 00026 00027 LinearCharacteristics::~LinearCharacteristics() {} 00028 00029 00030 float LinearCharacteristics::evaluate(float x) 00031 { 00032 float dum = this->gain*(x - this->offset); 00033 if(dum > this->ulim) 00034 dum = this->ulim; 00035 if(dum < this->llim) 00036 dum = this->llim; 00037 return dum; 00038 } 00039 00040 void LinearCharacteristics::setup(float xmin,float xmax, float ymin, float ymax){ // standard lin characteristics 00041 this->gain = (ymax - ymin)/(xmax - xmin); 00042 this->offset = xmax - ymax/this->gain; 00043 this->ulim = 999999.0; 00044 this->llim = -999999.0; 00045 } 00046 void LinearCharacteristics::setup(float xmin,float xmax, float ymin, float ymax,float ll, float ul){ // standard lin characteristics 00047 this->gain = (ymax - ymin)/(xmax - xmin); 00048 this->offset = xmax - ymax/this->gain; 00049 this->llim = ll; 00050 this->ulim = ul; 00051 } 00052
Generated on Tue Jul 12 2022 16:58:28 by
 1.7.2
 1.7.2