Sun 13 Jul 2014 03:03:31 PM UTC, original submission:
The fir1 function from the signal package generates incorrect results in Octave 3.8.1 compared to Octave 3.6.4 (and Matlab). I've tracked the mismatch down to the interp1 function (which is built-in I believe).
Below is the output of my fir1 testcase. Below that is the output of the interp1 function (which is called by fir2 - which is itself called from fir1).
GNU Octave, version 3.6.4
octave:1> fir1(32,0.2)'
ans =
-8.7001e-04
8.6629e-05
1.6246e-03
3.7088e-03
5.3433e-03
4.6062e-03
-3.5509e-04
-9.7044e-03
-2.0575e-02
-2.7019e-02
-2.1744e-02
7.7639e-04
4.1127e-02
9.3305e-02
1.4568e-01
1.8455e-01
1.9891e-01
1.8455e-01
1.4568e-01
9.3305e-02
4.1127e-02
7.7639e-04
-2.1744e-02
-2.7019e-02
-2.0575e-02
-9.7044e-03
-3.5509e-04
4.6062e-03
5.3433e-03
3.7088e-03
1.6246e-03
8.6629e-05
-8.7001e-04
GNU Octave, version 3.8.1
octave:1> fir1(32,0.2)'
ans =
3.4685e-04
4.8446e-04
6.5126e-04
7.4865e-04
6.3247e-04
2.7611e-04
1.0088e-06
6.5234e-04
3.5772e-03
1.0320e-02
2.2070e-02
3.9039e-02
6.0007e-02
8.2297e-02
1.0225e-01
1.1611e-01
1.2108e-01
1.1611e-01
1.0225e-01
8.2297e-02
6.0007e-02
3.9039e-02
2.2070e-02
1.0320e-02
3.5772e-03
6.5234e-04
1.0088e-06
2.7611e-04
6.3247e-04
7.4865e-04
6.5126e-04
4.8446e-04
3.4685e-04
GNU Octave, version 3.6.4
octave:1> m = interp1([0;0.2;0.2;1], [1;1;0;0], [0.00000 0.19805 0.20000 0.20195 1.00000])
m =
1 1 0 0 0
GNU Octave, version 3.8.1
octave:1> m = interp1([0;0.2;0.2;1], [1;1;0;0], [0.00000 0.19805 0.20000 0.20195 1.00000])
m =
1.00000 0.00975 0.00000 0.00000 0.00000
Note m(2) is completely different.
Please let me know if you require further information
Regards
Robert
|