Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

FFT core with magnitude data only?

Status
Not open for further replies.

Rob B

Full Member level 4
Joined
Oct 30, 2005
Messages
195
Helped
27
Reputation
56
Reaction score
18
Trophy points
1,298
Activity points
2,564
real fft get magnitude

I wondered whether this should be in the DSP section but it involves the Xilinx Core Generator.

After looking at the Core Generator FFT module datasheet, I see that the FFT core is expecting the data in complex format.

The data I want to transform is from an ADC and will be held in an array, the sampling will be constant rate.

Do I have to calculate the phase from the sample number and then apply the data to the FFT core?

I need to read The Scientist & Engineer's Guide to Digital Signal Processing.

I suppose what I am asking is "can I make a core for real DFT"?
 

xilinx fft core magnitude

Convert your ADC's real data into complex format by simply setting the imaginary parts to zero. Then feed that into the FFT.
 

calculate magnitude fft

I did think that at first but it seemed too simple and my FPGA learning-curve lately made me think twice when trying short-cuts!

I was trying to think of how the points would be placed with no Imaginary values present.

I will try either simulating that or getting the core into the device alongside the MicroBlaze (another mighty task for me!).

At present, I think I'm interested in STFT magnitude values along a sample.

I did read Chapter 9, and a few others, of the above titled PDF, a very good book and freely available.

I know what I want to do in my project but I get lost in some of the detail. I would need to master several disciplines simultaneously to really understand all of it, the thing that holds it all together is the FPGA itself though. I'm learning though, and will put back into EDABoard what I can as it has been such a help to me recently :).
 

calculate magnitude of fft

you can perform 2 transform at the price of 1 single FFT core, place the N data in real part for the 1st transform and N data in the imaginary part of the 2nd transform, perform a even odd decomposition on the output and you should get what you want.

btw, the above is just a simple explanation, read the book in detail, do some googling and you should find good info on it.

ps. you dont have to convert to complex form,
 

turn complex fft into real

Yes, here's a MATLAB demonstration of the technique that bcktang described. Notice that only one FFT is used, and the two output waveforms match the input waveforms. Blue is the real component, green is the imaginary component. Beware that the decomposition step, even though it's only simple arithmetic, takes significant time compared to a well-optimized FFT.

Code:
% Calculate two real FFTs by using only one complex FFT
clear;
N = 100;    % number of samples
n = 0:N-1;
% Generate two real input signals (noisy offset sinewaves)
a = sin(5.3 * 2*pi * n/N - 0.9) + (rand(1,N)-0.5) + 0.2;
b = sin(7.3 * 2*pi * n/N + 0.8) + (rand(1,N)-0.5) - 0.3;
subplot(2,2,1); plot(n,real(a),n,imag(a)); title('Input signal a');
subplot(2,2,2); plot(n,real(b),n,imag(b)); title('Input signal b');
% Combine the two real signals, compute combined complex FFT
ab = a + j*b;
yab = fft(ab);
% Decompose the FFT result into the spectra of signals a and b
even = (yab + fliplr(circshift(yab,[0 -1]))) / 2;  % even-odd decomposition
odd  = (yab - fliplr(circshift(yab,[0 -1]))) / 2;
YA = real(even) + j*imag(odd);
YB = imag(even) - j*real(odd);
% Show that the spectra of YA and YB match the original input signals
A = ifft(YA);
B = ifft(YB);
subplot(2,2,3); plot(n,real(A),n,imag(A)); title('Output A');
subplot(2,2,4); plot(n,real(B),n,imag(B)); title('Output B');
 

even/odd decomposition complex fft

Very interesting indeed :).

I don't think I have been taught that in DSP.

It would be nice to test it in hardware to measure the times taken for a single FFT and dual FFT with software decomposition. There are maybe some uses for this in my project as the transformation time of the initial data arrays is not important.

I'm having problems getting the FFT module into my MicoBlaze build (or any module for that matter), the whole lot will probably end up being done in software!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top