y = f(x) = x^k mit 1<=k<=3
This diagram shows both curves, the polynom and the original expo-function in a blue
colored line. The lines in red show the derivation of the blue line. Therefore you can
recognize the sensitivity of the stick at several working positions..
The polynom was used in the implementation because we can evaluate it without
usage of any floating point arithmetics.
#define RESX 512ul
#define RESK 100ul
uint16_t expou(uint16_t x, uint16_t k)
{
// k*x*x*x + (1k)*x
return ( (unsigned long)x * x * x / 0x10000 * k /
(RESX*RESX/0x10000)
+ (RESKk) * x + RESK / 2 ) / RESK;
}
This implementation needs only one real 32-bit Integer-Division.
23
Summary of Contents for Th9x
Page 1: ...Th9x M AN U AL E URG LE TH 9X N G ...
Page 31: ...31 ...