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.
TP1.h
00001 // Digitaler Tiefpass 1. Ordnung 00002 00003 class TP1Ord 00004 { 00005 private: 00006 float alpha; // Filterkonstante 00007 public: 00008 float yn_1; 00009 float y; // momentaner Ausgangswert des Filters 00010 public: 00011 00012 // Konstruktor wird automatisch aufgerufen 00013 // Variable der Klasse TP1Ord angelegt wird 00014 // interne Variablen sinnvoll initialisieren 00015 TP1Ord(); 00016 00017 // einen Abtastschritt des Filters rechnen 00018 // es entsteht ein neues y 00019 void CalcOneStep (float aX); 00020 00021 void SetAlpha (float aAlpha); 00022 }; 00023 00024 TP1Ord::TP1Ord() 00025 { 00026 y = 0; yn_1 = 0; 00027 SetAlpha(0.1); // sinnvolles Alpha einstellen 00028 } 00029 00030 void TP1Ord::SetAlpha (float aAlpha) 00031 { 00032 // 0...1 absichern 00033 if(aAlpha >= 0 && aAlpha <= 1) 00034 alpha = aAlpha; 00035 } 00036 00037 void TP1Ord::CalcOneStep (float aX) 00038 { 00039 y = alpha*aX + (1-alpha)*yn_1; 00040 yn_1 = y; // y einmal merken (zwischspeichern) 00041 }
Generated on Sat Jul 16 2022 17:50:41 by
 1.7.2
 1.7.2