DFT(Discrete Fourier Transform)


I made this function to calculate the DFT (discrete Fourier transform) but I do not run the arduino has errors the compiler does not interpret the (I> complex number)

X=zeros(1,N); for k=0:N-1 a=zeros(1,N); for n=0:N-1 a(n+1)=x(n+1)*exp(-(1i*2*pi*n*k)/N); end X(k+1)=sum(a);

thank you Gil

Post your actual sketch. That code will not compile in the Arduino IDE.

Generally speaking, computers don't know what complex numbers are, so they have to be programmed to manage them. There are libraries available, as was mentioned in your previous thread, or you can do the work yourself, which involves keeping track of the imaginary part of the calculation as well as the real part.

The code i present in the last post is a function i have developed in matlab, i have not yet developed any code for arduino, but the solution it's like that i think, i don't know work with complex numbers in arduino, and i don't know what the libraries i have to use. Have you a solution?

Thanks Gil :)