Reply by Fred Marshall February 15, 20072007-02-15
"marc" <marc.robins@gmail.com> wrote in message 
news:1171577308.283470.185100@m58g2000cwm.googlegroups.com...
> Do both implementations use a rectangular window? That would effect > your main lobe width and side lobe heights. There is also the effect > of zero-padding. If I'm not mistaken, increasing the FFT length by > zero-padding will create interpolative effects in the frequency > resolution. Are you using the same fft lengths? > > -marc
In Matlab "fft" has more than one form: fft(x) is of the length of x fft(x,n) is of the length n, no matter the length of x. So, if the second form is used then it could well be different than another implementation on a vector of the length of x. Also, "fft" often means or requires the length be a factor of 2 and a shorter length vector might be zero padded to make up the difference. I don't know what the TI DSP library does... Fred Fred
Reply by marc February 15, 20072007-02-15
Do both implementations use a rectangular window?  That would effect
your main lobe width and side lobe heights.  There is also the effect
of zero-padding. If I'm not mistaken, increasing the FFT length by
zero-padding will create interpolative effects in the frequency
resolution.  Are you using the same fft lengths?

-marc


Reply by Scott Seidman February 15, 20072007-02-15
Scott Seidman <namdiesttocs@mindspring.com> wrote in
news:Xns98D8899C85DDEscottseidmanmindspri@130.133.1.4: 

> Tim Wescott <tim@seemywebsite.com> wrote in > news:sJGdnYoniK7nXU7YnZ2dnUVZ_vLinZ2d@web-ster.com: > >> and you can bet that you'll never get the MathWorks to >> cough up their code. >> > > Actually, Mathworks makes no bones about using FFTW. Very well known, > and well tested. >
Oops, should read a bit further down before replying. -- Scott Reverse name to reply
Reply by Scott Seidman February 15, 20072007-02-15
Tim Wescott <tim@seemywebsite.com> wrote in 
news:sJGdnYoniK7nXU7YnZ2dnUVZ_vLinZ2d@web-ster.com:

> and you can bet that you'll never get the MathWorks to > cough up their code. >
Actually, Mathworks makes no bones about using FFTW. Very well known, and well tested. -- Scott Reverse name to reply
Reply by Fred Marshall February 15, 20072007-02-15
<stevenj@alum.mit.edu> wrote in message 
news:1171559284.478944.229240@v45g2000cwv.googlegroups.com...
> On Feb 15, 10:38 am, "quaste" <thomas.wald...@ctr.at> wrote: >> I can remember, that we had a similar problem one day: MATLAB and DSP >> (exactly the same you are using) and thought it was a precision-topic >> (single on the dsp), but after some nasty debugging sessions we almost >> had >> a perfect fit - the remaining perturbation definitly was about precision. >> And actually the result of an fft is something well- and uniquely >> defined, >> so if you don't mess up with ranges and the compared alg's are not >> extremly >> numerical unstable, the results have to fit. >> .. or am I wrong? > > Two caveats: > > * First, there are different conventions for defining the FFT, in the > normalization and in the sign of the exponent. If your DSP's FFT > convention is different from Matlab's, they will give different > results regardless of precision. Once you know the conventions, > however, it is trivial to convert in order to compare the two results. > > * Second, the results only have to fit to within the numerical > accuracy...the question is, what is the accuracy. A well-designed > floating-point FFT, such as Matlab's, has rms numerical errors that > grow as O(sqrt(log(N)))...for all except enormous sizes, this means it > is accurate to nearly machine precision (14-15 significant digits). > (See also www.fftw.org/accuracy). If your DSP chip uses a fixed-point > FFT algorithm, the rms errors grow much faster, as O(sqrt(N)), so its > errors are almost certainly much worse than Matlab's double-precision > results. > > Steven
Steven, The DSP supports floating point - IEEE I believe. Fred
Reply by February 15, 20072007-02-15
On Feb 15, 10:38 am, "quaste" <thomas.wald...@ctr.at> wrote:
> I can remember, that we had a similar problem one day: MATLAB and DSP > (exactly the same you are using) and thought it was a precision-topic > (single on the dsp), but after some nasty debugging sessions we almost had > a perfect fit - the remaining perturbation definitly was about precision. > And actually the result of an fft is something well- and uniquely defined, > so if you don't mess up with ranges and the compared alg's are not extremly > numerical unstable, the results have to fit. > .. or am I wrong?
Two caveats: * First, there are different conventions for defining the FFT, in the normalization and in the sign of the exponent. If your DSP's FFT convention is different from Matlab's, they will give different results regardless of precision. Once you know the conventions, however, it is trivial to convert in order to compare the two results. * Second, the results only have to fit to within the numerical accuracy...the question is, what is the accuracy. A well-designed floating-point FFT, such as Matlab's, has rms numerical errors that grow as O(sqrt(log(N)))...for all except enormous sizes, this means it is accurate to nearly machine precision (14-15 significant digits). (See also www.fftw.org/accuracy). If your DSP chip uses a fixed-point FFT algorithm, the rms errors grow much faster, as O(sqrt(N)), so its errors are almost certainly much worse than Matlab's double-precision results. Steven
Reply by Tim Wescott February 15, 20072007-02-15
quaste wrote:
(top posting fixed)
> > >>Hi, everyone! >> >>I use TMS320c6713 DSP. >>I compared result of complex fft library in TI DSP with result of >>complex fft in Matlab. >>Those waveform in frequency domain are similar, but exactly not >>matched. >> >>It means.. >>Range of result in DSP library is wider than one in Matlab. >> >>Why? >> >> >> >>Regards. >> >> > > I can remember, that we had a similar problem one day: MATLAB and DSP > (exactly the same you are using) and thought it was a precision-topic > (single on the dsp), but after some nasty debugging sessions we almost had > a perfect fit - the remaining perturbation definitly was about precision. > And actually the result of an fft is something well- and uniquely defined, > so if you don't mess up with ranges and the compared alg's are not extremly > numerical unstable, the results have to fit. > .. or am I wrong? >
I wouldn't be surprised to see things scaled differently, by 2 or 2^N or 2^(N/2). But barring problems with precision and overflow -- which I also wouldn't be surprised to see -- they should, indeed, be the same. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by quaste February 15, 20072007-02-15
I can remember, that we had a similar problem one day: MATLAB and DSP
(exactly the same you are using) and thought it was a precision-topic
(single on the dsp), but after some nasty debugging sessions we almost had
a perfect fit - the remaining perturbation definitly was about precision.
And actually the result of an fft is something well- and uniquely defined,
so if you don't mess up with ranges and the compared alg's are not extremly
numerical unstable, the results have to fit.
.. or am I wrong?

best regards,
Thomas



>Hi, everyone! > >I use TMS320c6713 DSP. >I compared result of complex fft library in TI DSP with result of >complex fft in Matlab. >Those waveform in frequency domain are similar, but exactly not >matched. > >It means.. >Range of result in DSP library is wider than one in Matlab. > >Why? > > > >Regards. > >
Reply by Oli Charlesworth February 15, 20072007-02-15
On Thu, 15 Feb 2007 05:10:18 -0000, Tim Wescott <tim@seemywebsite.com>  
wrote:

> stevenj@alum.mit.edu wrote: > >> On Feb 14, 9:08 pm, Tim Wescott <t...@seemywebsite.com> wrote: >> >>> Because the MathWorks and TI used different algorithms. A more >>> specific >>> answer depends on the details of the implementations in both MatLab and >>> the TI library -- and you can bet that you'll never get the MathWorks >>> to >>> cough up their code. >> Actually, you can download MathWorks' underlying FFT code from >> www.fftw.org >> > Well, good for them. Is this inside information, or does the MathWorks > publicize the fact that they use fftw?
It's mentioned on the MATLAB help page for fft(). In fact, they even go so far as to provide direct access to the underlying FFTW API via the fftw() function. -- Oli
Reply by Fred Marshall February 15, 20072007-02-15
<jaeper@gmail.com> wrote in message 
news:1171504053.322062.75200@m58g2000cwm.googlegroups.com...
> Hi, everyone! > > I use TMS320c6713 DSP. > I compared result of complex fft library in TI DSP with result of > complex fft in Matlab. > Those waveform in frequency domain are similar, but exactly not > matched. > > It means.. > Range of result in DSP library is wider than one in Matlab. > > Why?
As far as I know, Matlab uses greater precision arithmetic... Fred