Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two potential issues regarding dsps_fft4real example as well as documentation for cplx2real(). (DSP-91) #58

Open
Galfy1 opened this issue Nov 13, 2022 · 1 comment

Comments

@Galfy1
Copy link

Galfy1 commented Nov 13, 2022

Hello. I have found two potential issues while working with esp-dsp. These issues are unrelated to each other.

  1. In the dsps_fft4real example. When the result of cplx2real() is converted from complex to real power values, a division of N is used (aka binsize*2) However I would argue that a division of (binsize)^2 should be used instead when converting to power.
    Pow = ampl^2 --> Pow = (sqrt(Real^2+Img^2)/binsize)^2 --> Pow = (Real^2+Img^2) / binsize^2
    So the scaling in the dsps_fft4real example should be (N/2)^2 instead correct?

  2. In the documentation for dsps_cplx2real_sc16_ansi() it is stated that "Convert FFT result of complex FFT for real input to real array". However, as far as I understand, the result of cplx2real() is not real but complex. In the dsps_fft4real example the output of cplx2real() is also used as if it was complex. I understand that cplx2real has to be used when 1 real sequence is used as input, but is it not misleading to state that the output of cplx2real() is real?

@tom-borcin tom-borcin changed the title Two potential issues regarding dsps_fft4real example as well as documentation for cplx2real(). Two potential issues regarding dsps_fft4real example as well as documentation for cplx2real(). Apr 3, 2023
@github-actions github-actions bot changed the title Two potential issues regarding dsps_fft4real example as well as documentation for cplx2real(). Two potential issues regarding dsps_fft4real example as well as documentation for cplx2real(). (DSP-91) Apr 3, 2023
@dmitry1945
Copy link
Collaborator

Hi @Galfy1 ,

  1. We not use any divider because they could be different for direct and inverse FFTs. It’s up to user to apply any number.
  2. To save processing time we take two real input arrays with length N and make one complex array length N, where first array is real part, and second is imag part. Then we process this complex array with FFT and we will have one complex spectrum. Then we take this complex spectrum and by simple operation split this complex array of length N to two complex arrays with length N/2 (cplx2real function). Each of these arrays will be complex spectrum or input real signal. The result of cplx2real is two complex spectrum arrays with length of N/2.

Regards,
Dmitry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants