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.
Revision 1:57f0db59db9f, committed 2018-07-22
- Comitter:
- MTSAung
- Date:
- Sun Jul 22 15:22:22 2018 +0000
- Parent:
- 0:f2a2b5a88616
- Commit message:
- second order filter
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Jul 22 09:41:09 2018 +0000
+++ b/main.cpp Sun Jul 22 15:22:22 2018 +0000
@@ -12,9 +12,10 @@
double b = 0.0;
double c = 0.0;
double PI = 3.1416;
-double fc = 0.05/(2*PI);
-double C =(2*PI*fc)*(2*PI*fc) ;
-double B = sqrt(2*C);
+double fc = 15.0;
+double C = (2.0*PI*fc)*(2.0*PI*fc);
+double B = (2.0*PI*fc)*sqrt(2.0);
+
int main()
{
Timer myTime;
@@ -24,13 +25,13 @@
while(1) {
now_time = myTime.read_ms()/1000.0;
samp_time = now_time - prv_time;
- now_x = sin(2*PI*0.5*now_time) + 0.5*sin(2*PI*100*now_time);
+ now_x = sin(2.0*PI*0.5*now_time) + 0.25*sin(2*PI*50.0*now_time);
a = ((samp_time*samp_time)*C)*now_x;
- b = (2+(samp_time*B))*prv_d;
+ b = (2.0+(samp_time*B))*prv_d;
c = pr2v_d;
- now_d = (a+b-c)/(((samp_time*samp_time)*C)+(samp_time*B)+1);
-
- pc.printf(" %F %F %F %F\r", now_time, samp_time, now_x, now_d);
+ now_d = (a+b-c)/(((samp_time*samp_time)*C)+(samp_time*B)+1.0);
+
+ pc.printf(" %F %F\r", now_x, now_d);
printf("\n\r");
prv_time = now_time;
prv_d = now_d;