CODE¶
EFDD Implementation — FDD + IFFT + Log Decrement Damping
static int estimate_damping(const float *corr, int n_pts, float fs,
float freq, float *damping)
{
// Find positive peaks in IFFT time-domain signal
int n_peaks = 0, peak_indices[50];
for (int i = 2; i < n_pts - 1 && n_peaks < 50; i++)
if (corr[i] > corr[i-1] && corr[i] >= corr[i+1] && corr[i] > 0)
peak_indices[n_peaks++] = i;
if (n_peaks < 3) { *damping = 0.0f; return -2; }
// Select peaks with > 0.3× period spacing
float min_sep = (1.0f / freq) * fs * 0.3f;
// Adjacent peak log ratio → ζ
for (int i = 0; i < n_selected - 1; i++) {
float ratio = peaks[i] / peaks[i + 1];
if (ratio > 1.001f) {
double zeta = log((double)ratio) / (2.0 * M_PI);
if (zeta > 0.0 && zeta < 0.2) sum_damping += zeta;
}
}
*damping = (float)(sum_damping / n_pairs);
}
int tiny_sysid_efdd(...) {
// 1. FDD: CPSD → SVD → SV1 spectrum → peaks → freqs/shapes
// 2. Per mode: IFFT SV1[peak±3] → SDOF autocorrelation → estimate_damping()
// 3. Dedup by MAC
}