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.
PolynomialCharacteristics.cpp
00001 #include "PolynomialCharacteristics.h" 00002 #include "math.h" 00003 using namespace std; 00004 PolynomialCharacteristics::PolynomialCharacteristics(float *P,uint8_t degree,float ll, float ul){ // standard lin characteristics 00005 this->P = (float*)malloc(degree*sizeof(float)); 00006 for(int k=0;k<=degree;k++) 00007 this->P[k] =P[k]; 00008 this->degree = degree; 00009 this->llim = ll; 00010 this->ulim = ul; 00011 00012 } 00013 00014 PolynomialCharacteristics::~PolynomialCharacteristics() {} 00015 00016 00017 float PolynomialCharacteristics::evaluate(float x) 00018 { 00019 float dum = 0.0; 00020 for(int k=0;k<=degree;k++) 00021 dum = P[k]*pow(x,(float)k); 00022 if(dum > this->ulim) 00023 dum = this->ulim; 00024 if(dum < this->llim) 00025 dum = this->llim; 00026 return dum; 00027 }
Generated on Wed Jul 13 2022 23:05:32 by
1.7.2