2021-01-18 01:26 AM
Bonjour / Hello
A ce jour j’utilise le code ci-dessous pour calculer les FFT et les harmoniques de deux signaux sinusoïdaux.
Je souhaiterais calcul le déphasage entre les deux signaux en degré.
Pour cela je souhaiterai avoir les parties imaginaires des FFT.
Est-ce possible ?
Quelles fonctions utilisées ?
Merci d’avance.
To date I am using the code below to calculate the FFT and harmonics of two sine wave signals.
I would like to calculate the phase shift between the two signals in degrees.
For that I would like to have the imaginary parts of the FFTs.
Is it possible ?
What functions are used?
Thak you
arm_rfft_fast_f32 (&s_arm_rfft_fast, p_in_Signal_1, MES_fft_temp, 0);
arm_cmplx_mag_f32(MES_fft_temp, p_mag_fft_out_Signal_1, FFT_SIZE);
float h2 = (p_mag_fft_out_Signal_1[2] / p_mag_fft_out_Signal_1[1]) * 100 ;
float h3 = (p_mag_fft_out_Signal_1[3] / p_mag_fft_out_Signal_1[1]) * 100 ;
arm_rfft_fast_f32 (&s_arm_rfft_fast, p_in_Signal_2, MES_fft_temp, 0);
arm_cmplx_mag_f32(MES_fft_temp, p_mag_fft_out_Signal_2, FFT_SIZE);
float h2 = (p_mag_fft_out_Signal_2[2] / p_mag_fft_out_Signal_2[1]) * 100 ;
float h3 = (p_mag_fft_out_Signal_2[3] / p_mag_fft_out_Signal_2[1]) * 100 ;
Solved! Go to Solution.
2021-01-19 01:40 AM
2021-01-18 03:46 AM
For obtaining the imaginary part, you would need to use the complex FFT function, i.e. arm_cfft_***.c.
With the "older" DSP lib, they are located in ...\Libraries\CMSIS\DSP_Lib\Source\TransformFunctions\
Not sure with the Cube code, I am not a Cube user.
The DSP_Libs for the F4 used to come with a working FFT example:
...\Libraries\CMSIS\DSP_Lib\Examples\arm_fft_bin_example\
The example then calculates the magnitudes using arm_cmplx_mag_f32().
You might check how to adapt this for the phase value.
2021-01-18 07:24 AM
Hello,
Thank you for your comeback.
I looked at this example but I don't see how to translate it to calculate the angle between two singals.
Do you have an example to help me please.
Thank you in advance.
2021-01-19 01:13 AM
Hi,
After the FFT, I need to convert a complex number from cartesian (real + imaginary) to polar (magnitude + phase) coordinates.
how can i do this?
bye
2021-01-19 01:40 AM
2021-02-08 05:00 AM
Thank you !!
Merci !!