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.
Fork of IIR by
Revision 1:3d8226c5abfe, committed 2016-07-29
- Comitter:
- benson516
- Date:
- Fri Jul 29 14:55:33 2016 +0000
- Parent:
- 0:a7405ea45d27
- Child:
- 2:0bae37b297f4
- Commit message:
- Change the definition of the coefficient in denominator
Changed in this revision
| IIR.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/IIR.h Fri Jul 29 14:26:54 2016 +0000
+++ b/IIR.h Fri Jul 29 14:55:33 2016 +0000
@@ -1,5 +1,17 @@
#include <vector>
using std::vector;
+/*-----------------------------*/
+//
+// y gain*( sum(i from 0 to m) b[i]*x[k-i] )
+// --- = --------------------------------------------
+// u 1 + sum( i from 1 to n) a[i]*y[k-i]
+//
+// y[k] = gain*( sum(i from 0 to m) b[i]*x[k-i] ) - sum( i from 1 to n) a[i]*y[k-i]
+//
+// Compatible with the coefficient generated by Matlab fdatool
+//
+// by C.F. Huang from LDSC
+/*-----------------------------*/
class Circular_buffer{
private:
@@ -58,11 +70,16 @@
y.Init(n);
}
void Assign_parameters(float b_in[], float a_in[], float gain_in){
- b.assign(b_in,b_in+m+1);
- a.assign(a_in,a_in+n);
+ //b.assign(b_in,b_in+m+1);
+ // a.assign(a_in,a_in+n);
+ b.resize(m+1);
+ a.resize(n);
+ for (size_t i = 0; i < n; i++){
+ a[i] = a_in[i+1];
+ }
gain = gain_in;
for (size_t i = 0; i < b.size(); i++){
- b[i] *= gain;
+ b[i] = gain*b_in[i];
}
}
float Iterate_once(float x_in){
