Stefan Kiegerl
/
FuncGen
Function Generator for TINF 2021
Revision 2:d2e5b6c37b4b, committed 2021-03-18
- Comitter:
- stkiegerl
- Date:
- Thu Mar 18 21:24:21 2021 +0100
- Parent:
- 1:dbd814e65f1d
- Commit message:
- -
Changed in this revision
include/Tp1Ord.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/Tp1Ord.h Thu Mar 18 21:24:21 2021 +0100 @@ -0,0 +1,59 @@ + +#ifndef Tp1Ord_h +#define Tp1Ord_h + +class Tp1Ord { + private: + float _alpha; + float _beta; + float yn_1; // um eine Abtastung verzögertes y + public: + float y; // momentaner ausgangswert des Filtes + public: + Tp1Ord(); + + // Grenzfrequenz verstellen + void SetAlpha(float aAlpha); + + void CalcOneStep(float aX); +}; + +Tp1Ord::Tp1Ord() +{ + y=yn_1=0; + SetAlpha(0.1); // Vernünftiges Alpha setzen +} + +void Tp1Ord::SetAlpha(float aAlpha) +{ + _alpha=aAlpha; + _beta=1.0f-aAlpha; +} + +void Tp1Ord::CalcOneStep(float aX) +{ + y = _alpha*aX + _beta*yn_1; + // Verzögerung berechnen + yn_1 = y; +} + +#endif + + + + + + + + + + + + + + + + + + +