Questions on real and imaginary array for FFT implementation

Status
Not open for further replies.

invexed

Junior Member level 2
Joined
Nov 1, 2001
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
119
Hi all !!

I'm tring to make a litte FFt application

I'm tring with visual C++ first and later i'll try with my C microcontroller compiler

I have some questions...

First of all, it seems to be necessary to have a complex array with real and imaginary values

I have an array with a full sampled signal and i don't know exactly what to do with his...
I need to convert this array to a new array with real and imaginary part?
How can i do this?

FFT transform have a real and imaginary part too

The i need to convert this to a new array to make a graphical representation

I have found some FFT sources but not completes i only have fft functions with something like this:


fft(fftLength,RealInput, ImaginInput, RealOutput, ImaginOutput);

I need to know exactly the steps to convert a real sampled signal into a Real an Imaginary array to make an FFT

Someone can help me???

Thanks
 

Re: FFT implementation

hi guy,
if u need to ustand fft implementation then try first with matlab.if u need i can send u my sample code for finding 16 point fft for a complex signal.

in fft implementation, u need to work with twiddle factors raised to suitable powers in each stage.so while using these twiddle factors convert them to r*e^i(theta) form rather than (a+i*b) form since the first form would be easier in raising to higher powers.

u cant view ur complex values.u can only view their magnitude in c(i hope so).
 

Re: FFT implementation

Thanks viswa!!! if you can post your matlab code i'll try it....

I have some FFT examples in matlab but i cant see how to work this:

----------------------------------------------------------------------------------
t=1:200;
sin1=sin(2*pi*30/1000*t);

sin1c=abs(fft(sin1));

x=[0.005:.005:1];
subplot(2,1,1),plot(x,sin1c,'.'),title('DFT de la señal SIN1');
----------------------------------------------------------------------------------

Here only need a sampled signal and and obtain FFT without problems but when i use a real C function i need real and imaginary parts
 

FFT implementation

To feed real data into a complex FFT, simply copy your real data into the real part of a complex array, and set the imaginary part to zero.

One way to display the complex FFT result is to compute the magnitude of each complex value, mag=sqrt(real*real+imag*imag), and then display those magnitues. You may also want to convert the magnitudes to decibels, dB=20*log10(mag).
 
Re: FFT implementation

To best view the results try to use a number of points that is a power of two (64,128,...).

Ex.
fs=1; %sampling freq
fc=fs/16; %input freq
s=sqrt(2)*sin(2*pi/16*(0:1023);
plot(20*log10(abs(fft(s))/1024))

Regards,

--rs
 

Re: FFT implementation

Thanks Echo47 !!!

I have try your "mag=sqrt(real*real+imag*imag)" and it works
making ABS(real) it works too but i'm not sure if this is ok

I'm trying with a C function and it works ok with and without imaginary part!!

Making Imaginary part=0 y have a duplicate spectrum and 1/2 amplitude

Is this right ??
 

FFT implementation

Yes, if you zero the imag part, then there's no way to distinguish positive frequencies from negative frequencies, so the output from a complex FFT appears duplicated and mirrored and half the amplitude of a full complex signal. Simply ignore the upper half of the output array (that's the negative part, somewhat counter-intuitive).

If you feed a complex number into MATLAB's abs() function, it computes sqrt(real*real+imag*imag). Very convenient.
 

Re: FFT implementation

hello viswa..
i needed the sample code for 16pt fft implementation usng vhdl.. Can u plz send it to ma e-mail id- amithsanu@gmail.com...??? we want to implement 1024 pt fft on fpga usng vhdl... Can u help me out in this regard..?
Thank you..
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…