Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!cornell!uw-beaver!mit-eddie!xn.ll.mit.edu!xn!srf From: srf@claudius.juliet.ll.mit.edu ( Steve Feinstein) Newsgroups: comp.dsp Subject: Re: Check of an FFT routine... Message-ID: Date: 4 Apr 91 15:08:30 GMT References: <1991Apr4.004750.15969@en.ecn.purdue.edu> Sender: usenet@xn.ll.mit.edu Distribution: usa Organization: M.I.T. Lincoln Lab - Group 43 Lines: 92 In-Reply-To: jbs@en.ecn.purdue.edu's message of 4 Apr 91 00:47:50 GMT In article <1991Apr4.004750.15969@en.ecn.purdue.edu> jbs@en.ecn.purdue.edu (Spaggie) writes: > I have put together a program to do an FFT of any array of > data, but it doesn't seem to get the imag. part correct. > Can someone verify if this data is correct or not? > > > my fft routine then yeilds th > Data given Real, Imaginary > ----------- ------------------- > -0.005093 -0.000200,-0.000000 > -0.003797 -0.000201,-0.000001 > -0.001432 -0.000212,0.000010 > 0.004374 -0.000223,-0.000053 > 0.001606 -0.000722,-0.000263 > 0.000027 0.000427,0.000433 > -0.004548 -0.001282,-0.000314 > 0.000919 0.000184,0.001059 > 0.005288 0.000162,0.000016 > -0.004973 0.000187,0.000170 > -0.001283 -0.000096,-0.000125 > -0.001970 -0.000621,0.000399 > 0.002802 0.000027,0.000028 > 0.007448 0.000258,-0.000585 > -0.000214 -0.000188,-0.000254 > -0.006771 -0.000111,0.000147 > -0.004697 > 0.002116 > 0.003964 > 0.002788 > -0.000533 > -0.003011 > -0.000788 > 0.000005 > -0.000852 > 0.003107 > -0.001298 > -0.000009 > 0.001896 > -0.002197 > 0.000841 > -0.000112 > Can anyone verify this as being correct? Your values are wrong and there aren't enough of them, either. You should be generating at least N FFT points for an N-point array. The example you've posted is a 16-pt FFT on 32-pt data. Here is what MATLAB generated: -0.0023 -pi -0.0035 - 0.0047i -0.0060 + 0.0081i 0.0083 + 0.0187i 0.0009 - 0.0009i -0.0199 - 0.0128i -0.0031 + 0.0040i 0.0060 - 0.0055i 0.0052 - 0.0005i 0.0059 - 0.0339i -0.0410 + 0.0101i 0.0137 - 0.0138i -0.0231 + 0.0084i -0.0071 + 0.0017i -0.0068 - 0.0003i -0.0064 + 0.0000i -0.0064 0 -0.0064 - 0.0000i -0.0068 + 0.0003i -0.0071 - 0.0017i -0.0231 - 0.0084i 0.0137 + 0.0138i -0.0410 - 0.0101i 0.0059 + 0.0339i 0.0052 + 0.0005i 0.0060 + 0.0055i -0.0031 - 0.0040i -0.0199 + 0.0128i 0.0009 + 0.0009i 0.0083 - 0.0187i -0.0060 - 0.0081i -0.0035 + 0.0047i +pi -- Steve Feinstein +-------------------------------------------------------------------------+ | INTERNET: srf@juliet.ll.mit.edu | | USmail: S. Feinstein, MIT Lincoln Lab, 29 Hartwell Ave., | | Lexington, MA 02173 USA | | VOICE: (617) 981-4017 | +-------------------------------------------------------------------------+