DSPRelated.com
Forums

FFT Fixed Point in Matlab Code

Started by Mas Bas March 2, 2005
Folks,

Is there any free source code for FFT Fixed Point in Matlab Code ?

Thanks.

Rgds,

Berry
in article 4225c8ca$0$29279$14726298@news.sunsite.dk, Mas Bas at
buzzberry@gmail.com wrote on 03/02/2005 09:08:

> > Is there any free source code for FFT Fixed Point in Matlab Code ? >
i would like a copy, too. i have been thinking of writing the same for simulation for both educational reasons and a possible project in the future. it need only be the standard Cooley-Tukey radix-2 . this is why i had been thinking a lot about FFT quantization, lately, as in the other thread. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
I have written Radix-2 FFT fixed point code in C. I think I should be
able to convert it into Matlab in a relatively short time. I will post
it here once it is ready.

Btw, I have three implementations of the radix-2 decimation in
frequency FFT algorithm.

(a) not-inplace and recursive
(b) inplace and recursive
(c) inplace and non-recursive

I needed (c) for my application. But, it was easy for me to start with
(a) and step towards (c). I tested my code against matlabs' fft
function for various test cases and it seems to be bug free.

Since what you need is a matlab implementation, it makes more sense to
implement a fourth version that is not-inplace and non-recursive. Let
me know if you think otherwise. I will post it as soon as I am done.
Most likely during this weekend.

Kal wrote:
> I have written Radix-2 FFT fixed point code in C. I think I should be > able to convert it into Matlab in a relatively short time. I will
post
> it here once it is ready. > > Btw, I have three implementations of the radix-2 decimation in > frequency FFT algorithm. > > (a) not-inplace and recursive > (b) inplace and recursive > (c) inplace and non-recursive > > I needed (c) for my application. But, it was easy for me to start
with
> (a) and step towards (c). I tested my code against matlabs' fft > function for various test cases and it seems to be bug free. > > Since what you need is a matlab implementation, it makes more sense
to
> implement a fourth version that is not-inplace and non-recursive. Let > me know if you think otherwise. I will post it as soon as I am done. > Most likely during this weekend.
Sound interesting! Will your FFT package require the Fixed Point Toolbox? Will it allow a 40 bit accumulator and 16 bit data & coefficients? You might be interested to compare your package to Mark Borgerding's Kiss FFT at http://sourceforge.net/projects/kissfft/ John
Thanks Kal, we look forward to your FFT.

Cheers,
Berry,-

Kal wrote:
--deleted---
> Since what you need is a matlab implementation, it makes more sense to > implement a fourth version that is not-inplace and non-recursive. Let > me know if you think otherwise. I will post it as soon as I am done. > Most likely during this weekend. >
john wrote:
> > Will your FFT package require the Fixed Point Toolbox? > > Will it allow a 40 bit accumulator and 16 bit data & coefficients?
Thanks for asking all the right questions. I do not have the fixed point tb. I was thinking of using the interger types like INT16,32. That way the users dont need to have the fp-tb. I was thinking of 16 bit data + coefficients and a large enough accumulator that will avoid any over/under flows.
> > You might be interested to compare your package to Mark Borgerding's > Kiss FFT at http://sourceforge.net/projects/kissfft/
Looks interesting. I am yet to look at the source code though. Later, -Kalyan
Hi Berry,

Attached please find fixed-point FFT implementations in both M and C.

In the M implementation, to declare variables as fixed-point (as they are in
fft_example.m), the Fixed-Point Toolbox is required.  The other M-files will
work as-is with either floating-point or fixed-point input.

The C implementation is enclosed in a mex-file (so it can be called from
MATLAB). The C mex-file has int16 input and output, and int32 accumulator.

The accumulator and data can be set to any word length in the M fixed-point
object fi.

For an example of usage, run fft_example.m in MATLAB.

This was the main example used in the January 27th "Fixed-Point Programming
in MATLAB" webinar.  The recording of it has not been posted yet, but when
it is it will be here:
http://www.mathworks.com/products/fixed/demos.html

Let me know if the attachments don't come through, and I'll post them to
MATLAB Central.

Best wishes,
Tom Bryan
The MathWorks, Inc.

"Mas Bas" <buzzberry@gmail.com> wrote in message
news:4225c8ca$0$29279$14726298@news.sunsite.dk...
> Folks, > > Is there any free source code for FFT Fixed Point in Matlab Code ? > > Thanks. > > Rgds, > > Berry
Tom Bryan wrote:
> Hi Berry, > > Attached please find fixed-point FFT implementations in both M and C. > > In the M implementation, to declare variables as fixed-point (as they
are in
> fft_example.m), the Fixed-Point Toolbox is required. The other
M-files will
> work as-is with either floating-point or fixed-point input. > > The C implementation is enclosed in a mex-file (so it can be called
from
> MATLAB). The C mex-file has int16 input and output, and int32
accumulator.
> > The accumulator and data can be set to any word length in the M
fixed-point
> object fi. > > For an example of usage, run fft_example.m in MATLAB. > > This was the main example used in the January 27th "Fixed-Point
Programming
> in MATLAB" webinar. The recording of it has not been posted yet, but
when
> it is it will be here: > http://www.mathworks.com/products/fixed/demos.html > > Let me know if the attachments don't come through, and I'll post them
to
> MATLAB Central. > > Best wishes, > Tom Bryan > The MathWorks, Inc. > > "Mas Bas" <buzzberry@gmail.com> wrote in message > news:4225c8ca$0$29279$14726298@news.sunsite.dk... > > Folks, > > > > Is there any free source code for FFT Fixed Point in Matlab Code ? > > > > Thanks. > > > > Rgds, > > > > Berry
Is this code limited to power of two FFTs? John
Tom,

Where are the attachments? Please upload to MATLAB Central, and tell us its 
final location.

Cheers,

-- 
------------------------------
Jaime Andr&#4294967295;s Aranguren Cardona
jaac@sanjaac.com
SanJaaC Electronics
Soluciones en DSP
www.sanjaac.com


"Tom Bryan" <tbryan@mathworks.com> escribi&#4294967295; en el mensaje 
news:d0a1im$g2a$2@fred.mathworks.com...
> Hi Berry, > > Attached please find fixed-point FFT implementations in both M and C. > > In the M implementation, to declare variables as fixed-point (as they are > in > fft_example.m), the Fixed-Point Toolbox is required. The other M-files > will > work as-is with either floating-point or fixed-point input. > > The C implementation is enclosed in a mex-file (so it can be called from > MATLAB). The C mex-file has int16 input and output, and int32 accumulator. > > The accumulator and data can be set to any word length in the M > fixed-point > object fi. > > For an example of usage, run fft_example.m in MATLAB. > > This was the main example used in the January 27th "Fixed-Point > Programming > in MATLAB" webinar. The recording of it has not been posted yet, but when > it is it will be here: > http://www.mathworks.com/products/fixed/demos.html > > Let me know if the attachments don't come through, and I'll post them to > MATLAB Central. > > Best wishes, > Tom Bryan > The MathWorks, Inc.