|
|
@@ -157,7 +157,7 @@ def sfit4(data, fs): |
|
|
|
(Verified to match sfit4.m) |
|
|
|
""" |
|
|
|
N = len(data) |
|
|
|
t = linspace(0, (N-1) / fs, N) |
|
|
|
t = linspace(0, (N-1) / float(fs), N) |
|
|
|
|
|
|
|
## Estimate frequency using FFT (step b) |
|
|
|
Fc = fft(data) |
|
|
@@ -182,7 +182,7 @@ def sfit4(data, fs): |
|
|
|
i = arccos((Z2*cos(ni2) - Z1*cos(ni1)) / (Z2-Z1)) / n |
|
|
|
|
|
|
|
# Convert to Hz |
|
|
|
f0 = i * fs / N |
|
|
|
f0 = i * float(fs) / N |
|
|
|
|
|
|
|
# Fit it. We'll catch exceptions here and just returns zeros |
|
|
|
# if something fails with the least squares fit, etc. |
|
|
|