espressif / esp-dsp

DSP library for ESP-IDF
Apache License 2.0
442 stars 87 forks source link

Meaning of divide by N (DSP-94) #59

Closed kurtwerbrouck closed 11 months ago

kurtwerbrouck commented 1 year ago

Hello

I have 2 question on the next formule:

y2_cf[i] = ((y_cf[i 2 + 0] y_cf[i 2 + 0] + y_cf[i 2 + 1] y_cf[i 2 + 1])/N);

What is the meaning of devide by N in above formule.

Why is there not sqrt() function ?

Thanks

dmitry1945 commented 1 year ago

Hi @kurtwerbrouck ,

The result of FFT when you get sprectrum should be divided by sqrt(N), But we need 20*log10(abs(spectrum)), where abs(spectrum) = sqrt(real^2 + imag^2)/sqrt(N);

But, we can make so: 20log10(abs(spectrum)) = 10log10(abs(spectrum)^2) = 10*loag10((real^2 + imag^2)/N);

Regards, Dmitry