# Discrete Fourier Transform (DFT) Help

1. Aug 22, 2013

### btb4198

I took
f(t) = SIN(10*t) +SIN(5*t)
and got this
f(0) = 0
f(1) = -1.5
f(2) = 0.4
f(3) = -0.3

now I tried to do the DFT
Fs = 4Hz
N = 4 samples
3
f[r] = Ʃ x[k]ε^(-j(2πkr/4)
k=0

f[r] = 0 -1.5ε^(-j(2πr/4) + 0.4ε^(-j(2π(2)r/4) -0.3ε^(-j(2π(3)r/4)
f[0] = 0 - 1.5 + 0.4 - 0.3 = -1.4 // now that mean i have a frequency of 0 but I do not..
f[1] = 0 + 1.5j -0.4 -0.3 = 1.5j -0.7
f[2] = 0 +1.5 + 0.4 +0.3 = 2.2
f[3] = 0 -1.5-0.4 +0.3j = -1.9 + 0.3j

ok so I think I am close to understand how to do a DFT but I know that is wrong because I do not have a 0Hz frequency nor do I have a 2Hz frequency
I have 5 and 10

2. Aug 22, 2013

### jasonRF

I hope you realize that your signal has frequencies 10/(2*pi) and 5/(2*pi). Assuming t represents time in seconds, these correspond to about 1.6 and 0.8 Hz, and you are sampling at 1 Hz (you let t=0,1,2 and 3 seconds). If t has other units then scale accordingly. I did not check your arithmetic, but for this example you will need to understand aliasing, and what happens with signals whose frequencies are not exactly the centers of your frequency bins.

A simpler example would be to consider $f(t) = \exp\left( i \frac{\pi}{2} t \right)$ sampled at t=0,1,2 and 3. Here the frequency is 1/4 Hz and the sample rate is 1 Hz.

jason

3. Aug 22, 2013

### btb4198

jasonRF:

no I did not know that...
frequencies 10/(2*pi) and 5/(2*pi)
where did that come from ?

I thought it was F(t) = sin(10*t)

4. Aug 23, 2013

### jasonRF

For a sinusoid, if $t$ is in seconds and the frequency $f$ is in Hz, then the function looks like $f(t) = \sin(2 \pi f t)$. Think about what it means. At time $t=1/f$ the argument of the sine is simply $2\pi$, which means you are at the time it takes for a single cycle of the function. So if the frequency is 5 Hz, at time 0.2 seconds you have gone through a complete cycle. In your case, you have two frequencies, $2 \pi f_1 = 10$ and $2\pi f_2 = 5$.

jason

Last edited: Aug 23, 2013
5. Aug 24, 2013

### btb4198

ok I did that
F = 10 / 2π
f(t) = 10sin( F*2*PI * t)
for 0< T< 16
and
i got
0
-5.4402111088937
9.12945250727628
-9.88031624092862
7.45113160479349
-2.62374853703929
-3.04810621102217
7.73890681557889
-9.93888653923375
8.93996663600558
-5.06365641109759
-0.44242678085071
5.80611184212314
-9.30105950186762
9.80239659440312
-7.14876429629165
2.19425258379005

F[0] = -4.01920962704459// this should be 0
F[1] = -4.14537895434982 // this should be 0
F[2] = -4.57274112337475// this should be 0
F[3] = -5.49565172200391// this should be 0
F[4] = -7.50172957187673// this should be 0
F[5] = -12.8720176748774// this should be 0
F[6] = -41.819518848926// this should be 0
F[7] = 62.2685945081662// this should be 0
F[8] = 32.2960964015296// this should be 0
F[9] = 62.2685945081661// this should be 0
F[10] = -41.8195188489261

why?
what I am doing wrong ?

6. Aug 24, 2013

### btb4198

UP date
ok now I am going this
for 0 < i <16
t1 = i / 120;
F(t) = Sin( 2 * PI* t1 );

0
0.0523359562429438
0.104528463267653
0.156434465040231
0.207911690817759
0.258819045102521
0.309016994374947
0.3583679495453
0.4067366430758
0.453990499739547
0.5
0.544639035015027
0.587785252292473
0.629320391049838
0.669130606358858
0.707106781186547
0.743144825477394
F[0] = 5.94612377310945
F[1] = -0.487400945100295
F[2] = -0.401272266173451
F[3] = -0.385629134617898
F[4] = -0.38024247781543
F[5] = -0.3778404948171
F[6] = -0.376648333895417
F[7] = -0.376075997767909

this seem to be working

I know that is the number of sample from the sin wave..
what do you all think?

7. Aug 24, 2013

### btb4198

ok I am not setting up the test sine wave right
can some one help me?

8. Aug 24, 2013

### jasonRF

Have you tried the example I gave you?

9. Aug 24, 2013

### btb4198

yes
cry...

10. Aug 25, 2013

### jasonRF

I'm curious what reading you have done on the DFT - have yuo looked at any books or web sites that explain the theory? Anyway, there are a couple of issues you need to understand about this current example of yours:

1) the DFT assumes that your signal is periodic, and the sequence that you give it is one period. So to understand the periodic signal you are analyzing, think about the sequence of numbers you give it, and then make copies of that sequence on both sides of your signal. In your case you have a 1 Hz signal sampled at 120 Hz (which is good, you are no longer doing an aliased example). However, you are only taking 17 samples, so you only have 17/120 of a sinusoid. If you think about making copies of it right an left, you are essentially giving the DFT a sawtooth kind of signal. The "edges" have lots of high frequency content. That is why the example I gave you I made sure that I gave you exactly one cycle, since that is the first case you should try as it is simple to understand.

2) Your 1 Hz signal is not centered on a DFT frequency bin. You need to learn what frequencies correspond to the bins in your DFT sequence. you have 17 samples at 120 Hz, for a total of 17/120 of a second of signal. Thus the frequencies associated with your sequence after the DFT are at 0, 120/17, 240/17, 360/17, etc. Hz. So your 1 Hz signal is not at the center of any bin, so you will see the sidelobes from the signal show up in all of the bins.

jason

11. Aug 25, 2013

### btb4198

sorry I do not understand how this will work
F[t] =e^(i(pi/2) *t )

-1.81275621683602E-14
1
4.86454409739934E-16
-1
-1.12670560815237E-14
1
2.20476577533074E-14
-1
-4.40654999468715E-15
1
1.51871516664709E-14
-1
-2.59677533382546E-14
1
3.67483550100384E-14
-1
9.31446217898591E-15
1
1.46613949279784E-15
-1
-1.22467411645816E-14
1
2.30273428363653E-14
-1
-3.38079445081491E-14
1
-1.22548726808752E-14
-1
1.47427100909148E-15
1
9.30633066269226E-15
-1
-2.0086932334476E-14
1
3.08675340062597E-14
-1
1.51952831827645E-14
1
-4.41468151098079E-15
-1
-6.36592016080295E-15
1
1.71465218325867E-14
-1
-2.79271235043704E-14
1
3.87077251761542E-14
-1
7.3550920128701E-15

that is the real values

F[0] = 1.36807096684163E-13
F[1] = 2.84008927486923E-14
F[2] = 5.27911048209262E-14
F[3] = 4.80310236028458E-14
F[4] = 1.55431223447522E-15
F[5] = 3.3584246494911E-14
F[6] = 6.85285161949878E-14
F[7] = -6.48925357893404E-14
F[8] = 1.76803016671556E-14
F[9] = -5.88418203051333E-14
F[10] = 3.06421554796543E-14
F[11] = 2.39031017201796E-13
F[12] = 1.12798659301916E-13
F[13] = 8.7208018584306E-14
F[14] = 1.91124893689221E-13
F[15] = 3.05311331771918E-14
F[16] = -4.56301663120939E-14
F[17] = -1.06248343456627E-13
F[18] = 1.40443212615082E-13
F[19] = 4.72955008490317E-14
F[20] = 2.97539770599542E-14
F[21] = -1.77635683940025E-14
F[22] = 3.75255382323303E-14
F[23] = -3.14193115968919E-14
F[24] = 5.17363929475323E-14
F[25] = -5.19584375524573E-14
F[26] = 2.33146835171283E-15
F[27] = 1.18793863634892E-13
F[28] = 1.90625293328139E-13
F[29] = 2.18824958153618E-13
F[30] = 3.02424751907893E-13
F[31] = 5.91748872125208E-14
F[32] = -1.30673249998381E-13
F[33] = -3.17190718135407E-13
F[34] = 6.16173778666962E-14
F[35] = -1.13242748511766E-14
F[36] = -6.0507154842071E-14
F[37] = -1.15574216863479E-13
F[38] = 4.61852778244065E-14
F[39] = 6.58362253602718E-14
F[40] = -1.60982338570648E-14
F[41] = 8.63753513158372E-14
F[42] = -7.88258347483861E-14
F[43] = -1.8052226380405E-13
F[44] = 1.53765888910584E-13
F[45] = 3.61932706027801E-14
F[46] = 2.04170014228566E-13
F[47] = -2.51909604287448E-13
F[48] = -4.49418280368263E-13
F[49] = 6.46704911844154E-13
F[50] = 200
F[51] = -2.16604512104368E-13
F[52] = 4.95936625100057E-13
F[53] = 1.6198153929281E-13
F[54] = -4.0911718457437E-13
F[55] = 1.37889699658444E-13
F[56] = 1.45772283133283E-13
F[57] = 3.22075699443758E-13
F[58] = -6.30606677987089E-14
F[59] = -5.10924635932497E-13
F[60] = -1.54654067330284E-13
F[61] = 3.81250586656279E-13
F[62] = 1.43551837084033E-13
F[63] = 1.31783473023006E-13
F[64] = 8.24895707296491E-14
F[65] = -9.33697563709757E-14
F[66] = 1.28008714739281E-13
F[67] = 2.98872038229092E-13
F[68] = 4.47641923528863E-13
F[69] = -1.01918473660589E-13
F[70] = -2.96429547574917E-13
F[71] = 4.48530101948563E-14
F[72] = -2.23709939461969E-13
F[73] = -6.88338275267597E-14
F[74] = 1.36890498936282E-13
F[75] = -1.18127729820117E-13
F[76] = -1.53654866608122E-13
F[77] = -3.81916720471054E-14
F[78] = -2.45692355349547E-13
F[79] = -1.06248343456627E-13
F[80] = -6.21724893790088E-14
F[81] = -1.78634884662188E-13
F[82] = -3.09752223870419E-14
F[83] = 2.19824158875781E-14
F[84] = 1.92956761679852E-13
F[85] = -4.41868763800812E-14
F[86] = -6.51312337396348E-13
F[87] = 2.4008572907519E-13
F[88] = -1.51878509768721E-13
F[89] = -2.70561351101151E-13
F[90] = -2.80608869474008E-13
F[91] = 1.36779476633819E-13
F[92] = -1.52183821100493E-13
F[93] = 3.33122418538778E-13
F[94] = -1.75470749042006E-13
F[95] = 1.02140518265514E-14
F[96] = 3.63598040564739E-14
F[97] = -1.66380798027888E-13
F[98] = -8.14764922196787E-14
F[99] = 8.4760670704398E-13
F[100] = -8.79020434999683E-14
F[101] = 3.50657003433952E-13
F[102] = 4.49876247365921E-13
F[103] = -7.08877401223162E-14
F[104] = 2.52353693497298E-13
F[105] = -3.65818486613989E-14
F[106] = -2.55684362571174E-13
F[107] = -4.90607554581857E-13
F[108] = 6.83064715900628E-14
F[109] = 2.26763052779688E-13
F[110] = 1.26526567001406E-12
F[111] = -9.12048214729566E-14
F[112] = 3.04201108747293E-14
F[113] = -6.45039577307216E-14
F[114] = 7.66220420445052E-13
F[115] = -2.59903210064749E-13
F[116] = 1.84741111297626E-13
F[117] = 8.85957973650875E-14
F[118] = -1.07136521876328E-13
F[119] = 1.16573417585641E-14
F[120] = 2.45914399954472E-13
F[121] = -8.32556246166405E-13
F[122] = -4.14446255092571E-13
F[123] = -2.22488694134881E-13
F[124] = -3.19411164184658E-13
F[125] = -1.58761892521397E-13
F[126] = 5.71875879984418E-13
F[127] = 1.91846538655227E-13
F[128] = 1.36890498936282E-13
F[129] = 5.69544411632705E-14
F[130] = 3.3850700020821E-13
F[131] = -2.74780198594726E-13
F[132] = -3.20743431814208E-13
F[133] = -2.99760216648792E-14
F[134] = -8.61866134016509E-13
F[135] = -1.38888900380607E-13
F[136] = 4.48863168855951E-13
F[137] = 9.24815779512755E-14
F[138] = 2.30149233004795E-13
F[139] = 3.80473430539041E-13
F[140] = -6.97220059464598E-14
F[141] = 5.11812814352197E-14
F[142] = -2.21045404202869E-13
F[143] = -1.18571819029967E-13
F[144] = 6.96109836439973E-13
F[145] = -6.48370246381091E-14
F[146] = -5.03042052457658E-13
F[147] = 9.75886038645513E-14
F[148] = -7.54951656745106E-15
F[149] = -1.47160061914064E-12
F[150] = 0
F[151] = 2.50910403565285E-14
F[152] = 7.00550728538474E-14
F[153] = -2.27928786955545E-13
F[154] = -4.10782519111308E-14
F[155] = -1.20237153566904E-13
F[156] = -2.72115663335626E-13
F[157] = -6.46371844936766E-13
F[158] = 1.15685239165941E-13
F[159] = 2.25375273998907E-14
F[160] = -4.33320046511199E-13
F[161] = 2.93098878501041E-14
F[162] = -3.75255382323303E-14
F[163] = -2.29150032282632E-13
F[164] = -4.18332035678759E-13
F[165] = -2.61457522299224E-13
F[166] = 2.47690756793872E-13
F[167] = 1.09579012530503E-13
F[168] = -3.79918319026729E-13
F[169] = 4.40203429263875E-13
F[170] = 6.83897383169096E-14
F[171] = 1.11022302462516E-13
F[172] = 4.27435864480685E-13
F[173] = -2.08721928629529E-13
F[174] = 1.23345778035855E-13
F[175] = 6.13953332617712E-14
F[176] = 4.29656310529936E-14
F[177] = -1.10389475338479E-12
F[178] = -9.68114477473137E-14
F[179] = -1.32227562232856E-13
F[180] = -1.77635683940025E-15
F[181] = 3.12860848339369E-13
F[182] = -3.75477426928228E-13
F[183] = 1.63247193540883E-12
F[184] = 6.49480469405717E-14
F[185] = 3.54771767518969E-13
F[186] = 3.76032538440541E-13
F[187] = -1.13242748511766E-14
F[188] = 6.16173778666962E-15
F[189] = -1.31228361510694E-13
F[190] = -3.23574500527002E-13
F[191] = -1.54304347077527E-12
F[192] = -4.27741175812457E-13
F[193] = 1.16046061648944E-13
F[194] = 2.95208302247829E-13
F[195] = -1.34670052887031E-13
F[196] = 5.89972515285808E-13
F[197] = 1.46521683674905E-13
F[198] = -1.51365031619832E-13
F[199] = 1.84852133600089E-14
F[200] = 3.76647226862231E-14
F[201] = -2.88866153219658E-13
F[202] = 3.81666920290513E-13
F[203] = 1.99007477164059E-13
F[204] = 9.29090138157562E-13
F[205] = -1.09043329921121E-12
F[206] = 1.57956980828544E-13
F[207] = -9.55346912689947E-14
F[208] = 7.65443264327814E-13
F[209] = 1.5093482019779E-13
F[210] = -4.54081217071689E-14
F[211] = 2.85771406538515E-13
F[212] = 1.09079412169422E-13
F[213] = -4.34541291838286E-13
F[214] = 1.58040247555391E-13
F[215] = 4.43367564884056E-13
F[216] = 2.61513033450456E-13
F[217] = 4.32098801184111E-13
F[218] = 2.98872038229092E-13
F[219] = -7.56728013584507E-13
F[220] = -2.61235477694299E-13
F[221] = -1.45894407665992E-12
F[222] = -3.30069305221059E-13
F[223] = 8.59978754874646E-13
F[224] = 4.59632332194815E-14
F[225] = 7.88702436693711E-13
F[226] = -4.10671496808845E-13
F[227] = 1.7874590696465E-14
F[228] = 1.52544643583497E-13
F[229] = 4.78173056706055E-13
F[230] = -2.09388062444305E-13
F[231] = -2.88324919495153E-13
F[232] = -1.72528658026749E-13
F[233] = -1.11255449297687E-12
F[234] = 7.55728812862344E-13
F[235] = -2.77555756156289E-14
F[236] = 1.98285832198053E-13
F[237] = 1.98729921407903E-13
F[238] = -3.21631610233908E-13
F[239] = 4.47974990436251E-13
F[240] = 8.95283847057726E-13
F[241] = 5.35904653986563E-13
F[242] = -1.49769086021934E-13
F[243] = 4.16000567327046E-13
F[244] = 1.77224901420914E-12
F[245] = 4.20330437123084E-13
F[246] = 6.53033183084517E-13
F[247] = -3.26294546937334E-13
F[248] = 1.65001345919791E-12
F[249] = 3.96871424612755E-12
F[250] = 200
F[251] = 1.93145499594038E-12
F[252] = 1.42263978375468E-12
F[253] = 7.18758386142326E-13
F[254] = 4.06341627012807E-13
F[255] = 6.45261621912141E-13
F[256] = -1.0866862965031E-12
F[257] = -1.46882506157908E-12
F[258] = -6.86117829218347E-14
F[259] = -3.52717854923412E-13
F[260] = -6.33049168641264E-13
F[261] = -1.21203047598328E-12
F[262] = -1.30673249998381E-13
F[263] = -3.06421554796543E-14
F[264] = 2.65121258280487E-13
F[265] = 1.98396854500515E-13
F[266] = 2.80109269112927E-13
F[267] = -5.36348743196413E-13
F[268] = 9.84878845144976E-13
F[269] = 1.81743509131138E-13
F[270] = -1.2081446953971E-12
F[271] = -7.90256748928186E-13
F[272] = -3.89022147828655E-13
F[273] = 7.86037901434611E-14
F[274] = -2.97428748297079E-13
F[275] = -2.46058728947673E-12
F[276] = -3.22519788653608E-13
F[277] = -7.60946861078082E-13
F[278] = -6.7257310831792E-13
F[279] = 1.5780710072022E-12
F[280] = -2.3214763444912E-13
F[281] = 3.81916720471054E-13
F[282] = -1.01030295240889E-14
F[283] = 2.37032615757471E-13
F[284] = -7.2908346027134E-13
F[285] = 2.53075338463304E-13
F[286] = -2.08055794814754E-13
F[287] = -1.4477308241112E-13
F[288] = -1.10744746706359E-13
F[289] = -1.22019061521428E-12
F[290] = 4.62130334000221E-13
F[291] = -5.55555601522428E-13
F[292] = 4.83002526863174E-13
F[293] = -1.04877218021215E-12
F[294] = 6.6044392177389E-13
F[295] = -3.43419737092177E-13
F[296] = -7.72437669382953E-14
F[297] = 1.1671219546372E-13
F[298] = 2.63858379589976E-13
F[299] = -3.28966021090338E-13
F[300] = 5.57025969403699E-13
F[301] = 4.40904257548169E-13
F[302] = 7.31151250654705E-13
F[303] = 2.44512743385883E-13
F[304] = -6.40265618301328E-13
F[305] = 3.16136006262013E-13
F[306] = -5.3002047195605E-13
F[307] = -3.58907348285697E-13
F[308] = 5.732636587652E-13
F[309] = 8.79907258166668E-13
F[310] = 8.48099368511157E-13
F[311] = -8.76521077941561E-14
F[312] = 8.09907696464052E-14
F[313] = -1.1785017406396E-13
F[314] = 5.14976949972379E-13
F[315] = -1.5931700403371E-13
F[316] = -1.52916568296746E-12
F[317] = 5.27355936696949E-14
F[318] = 3.10751424592581E-13
F[319] = 1.73416836446449E-13
F[320] = -6.29496454962464E-14
F[321] = -1.28341781646668E-13
F[322] = -2.92654789291191E-13
F[323] = 5.68767255515468E-13
F[324] = -3.78808096002103E-13
F[325] = 4.17887946468909E-13
F[326] = 3.45279360658424E-13
F[327] = 1.53466128693935E-12
F[328] = 5.45674616603264E-13
F[329] = -2.24487095579207E-13
F[330] = 2.02948768901479E-13
F[331] = -3.68260977268164E-13
F[332] = 5.79425396551869E-13
F[333] = 3.1641356201817E-13
F[334] = -3.574918139293E-14
F[335] = -1.79412040779425E-13
F[336] = 3.86135567964629E-13
F[337] = 9.31255073055581E-13
F[338] = -1.28752564165779E-12
F[339] = -2.07056594092592E-13
F[340] = -5.75872682873069E-13
F[341] = -3.87800902501567E-13
F[342] = 4.75064432237104E-13
F[343] = -6.26609875098438E-13
F[344] = -9.40136857252583E-13
F[345] = 3.43391981516561E-13
F[346] = -4.90607554581857E-13
F[347] = -1.20681242776755E-13
F[348] = 2.19158025061006E-13
F[349] = -5.10702591327572E-13
F[350] = 0
F[351] = -7.58282325818982E-14
F[352] = -6.05848704537948E-13
F[353] = 4.17998968771371E-13
F[354] = -9.38582545018107E-13
F[355] = 1.08957287636713E-12
F[356] = -2.90878432451791E-14
F[357] = 1.6198153929281E-12
F[358] = -1.47548639972683E-13
F[359] = -4.25770529943748E-13
F[360] = 8.59423643362334E-13
F[361] = 8.31668067746705E-13
F[362] = 1.37312383685639E-12
F[363] = -4.07895939247283E-13
F[364] = -6.16284800969424E-13
F[365] = 1.05349062806681E-12
F[366] = -6.86783963033122E-13
F[367] = 9.28590537796481E-13
F[368] = 2.23376872554581E-13
F[369] = -8.86735129768113E-13
F[370] = 4.81836792687318E-13
F[371] = -7.4362738189393E-13
F[372] = 1.73483449827927E-12
F[373] = 6.31716901011714E-13
F[374] = -5.01154673315796E-13
F[375] = -5.38680211548126E-13
F[376] = -1.1785017406396E-12
F[377] = -7.73936470466197E-13
F[378] = -1.38111744263369E-13
F[379] = 1.7608137170555E-13
F[380] = -1.10467190950203E-12
F[381] = -6.66133814775094E-16
F[382] = -5.37569988523501E-13
F[383] = 2.25708340906294E-13
F[384] = -2.359834549992E-12
F[385] = 3.96904731303493E-13
F[386] = 1.85518267414864E-13
F[387] = 2.4980018054066E-13
F[388] = 2.35261810033194E-12
F[389] = -1.00192076857297E-12
F[390] = -1.79800618838044E-12
F[391] = -3.80973030900122E-13
F[392] = -8.97920626741211E-13
F[393] = -8.53206394424433E-14
F[394] = -5.9643956440425E-13
F[395] = 2.65731880944031E-13
F[396] = -6.432354648922E-13
F[397] = -6.23417983902641E-13
F[398] = 4.21454537935517E-13
F[399] = -6.78498923711857E-13
F[400] = -6.21437851264922E-14
F[401] = -2.34454122782779E-12
F[402] = 8.30252533390308E-13
F[403] = -9.10410635768244E-13
F[404] = 5.45535838725186E-13
F[405] = -4.17527123985906E-13
F[406] = -2.38142838782096E-14
F[407] = 8.9767082656067E-13
F[408] = 4.62824223390612E-13
F[409] = 1.52211576676109E-13
F[410] = 2.18769447002387E-13
F[411] = -1.90070181815827E-12
F[412] = 3.14581694027538E-13
F[413] = 4.70290473231216E-13
F[414] = 7.04214464519737E-13
F[415] = 9.47852907273727E-13
F[416] = -1.67532654415936E-13
F[417] = 2.00506278247303E-13
F[418] = 1.80711001718237E-12
F[419] = 8.53650483634283E-13
F[420] = -2.15161222172355E-12
F[421] = -7.13873404833976E-14
F[422] = 1.27253763082535E-12
F[423] = 3.52051721108637E-13
F[424] = -6.40598685208715E-13
F[425] = -5.33351141029925E-13
F[426] = 2.28572716309827E-12
F[427] = 3.49720252756924E-14
F[428] = 5.46229728115577E-13
F[429] = 1.00475183728577E-13
F[430] = 1.25544019624613E-12
F[431] = -1.25666144157321E-12
F[432] = 3.13971071363994E-12
F[433] = -3.82360809680904E-13
F[434] = 2.316147273973E-12
F[435] = 2.87547763377916E-14
F[436] = 1.42807987657534E-12
F[437] = 4.0600856010542E-13
F[438] = -3.6981528950264E-13
F[439] = 1.12798659301916E-13
F[440] = -9.61897228535236E-13
F[441] = -8.52762305214583E-13
F[442] = 2.28039809258007E-12
F[443] = 4.57978099888123E-12
F[444] = -8.17124146124115E-14
F[445] = 9.43245481721533E-13
F[446] = 1.12410081243297E-12
F[447] = 3.04833935871329E-12
F[448] = 9.73665592596262E-13
F[449] = -2.59003929414803E-12
F[450] = 200
F[451] = 2.36322073021711E-12
F[452] = -2.9597435613482E-12
F[453] = -4.94160268260657E-13
F[454] = -1.77657888400518E-12
F[455] = -1.26565424807268E-13
F[456] = -1.42674760894579E-12
F[457] = 4.76507722169117E-13
F[458] = 2.8199664825479E-13
F[459] = 1.07469588783715E-13
F[460] = 1.48636658536816E-12
F[461] = -5.88418203051333E-14
F[462] = -1.02140518265514E-14
F[463] = -1.79856129989275E-13
F[464] = 3.77697872977478E-13
F[465] = -2.35134134385362E-12
F[466] = -1.18127729820117E-13
F[467] = 3.92241794600068E-13
F[468] = -1.8952617253376E-12
F[469] = -1.75970349403087E-13
F[470] = -2.05169214950729E-13
F[471] = -2.18158824338843E-13
F[472] = 1.79967152291738E-13
F[473] = 3.72368802459278E-13
F[474] = 3.23741033980696E-13
F[475] = 3.67506025611419E-12
F[476] = 7.37854222165879E-13
F[477] = 4.37871960912162E-13
F[478] = -4.61852778244065E-13
F[479] = -8.43991543320044E-13
F[480] = 1.27942101357803E-12
F[481] = -3.98570065840431E-13
F[482] = -4.54414283979077E-13
F[483] = 3.17412762740332E-13
F[484] = -5.94524429686771E-14
F[485] = 4.57356374994333E-13
F[486] = -1.94372296036249E-12
F[487] = -1.05615516332591E-12
F[488] = 2.31481500634345E-14
F[489] = -7.03326286100037E-13
F[490] = -1.72967196121476E-12
F[491] = 2.93653990013354E-14
F[492] = -3.07004421884471E-13
F[493] = -9.1621155107191E-13
F[494] = -6.20420381736153E-13
F[495] = 1.35241817744713E-12
F[496] = 7.54896145593875E-13
F[497] = 1.81643589058922E-12
F[498] = 2.39711028804379E-13
F[499] = 9.53993828378685E-13
F[500] = -8.47073631940823E-13
F[501] = -2.40805986262416E-12
F[502] = 6.11510841963536E-13
F[503] = 7.56311679950272E-13
F[504] = -8.37246938445446E-13
F[505] = -2.2154500456395E-13
F[506] = 8.24146306754869E-13
F[507] = 1.37304057012955E-12
F[508] = 5.07843767039162E-13
F[509] = 2.62234678416462E-13
F[510] = -7.7454709312974E-13
F[511] = -3.02535774210355E-13
F[512] = -1.0547118733939E-13
F[513] = 6.41930952838266E-13
F[514] = 2.66453525910038E-15
F[515] = -8.1690210151919E-13
F[516] = 2.38087327630865E-13
F[517] = -1.81188397618826E-12
F[518] = 1.16362475210963E-12
F[519] = -2.2903900998017E-13
F[520] = 2.18491891246231E-13
F[521] = -6.75015598972095E-13
F[522] = -2.41806574763359E-13
F[523] = 1.98285832198053E-13
F[524] = 1.01640917904433E-12
F[525] = 1.75492953502498E-12
F[526] = -3.52384788016025E-13
F[527] = -1.60949031879909E-12
F[528] = -4.30766533554561E-13
F[529] = -1.93178806284777E-13
F[530] = 4.89164264649844E-13
F[531] = -5.11146680537422E-13
F[532] = 6.96109836439973E-13
F[533] = -1.10833564548329E-12
F[534] = -1.42208467224236E-12
F[535] = 6.96331881044898E-13
F[536] = -1.75415237890775E-14
F[537] = -3.01980662698043E-14
F[538] = 5.21804821573824E-14
F[539] = -5.43676215158939E-13
F[540] = 3.39261951864955E-12
F[541] = -3.46278561380586E-13
F[542] = 2.76156875145261E-12
F[543] = 1.86628490439489E-13
F[544] = 8.80961970040062E-13
F[545] = -2.71105360383217E-12
F[546] = 1.14319664845652E-12
F[547] = -5.66546809466217E-13
F[548] = -1.249889081123E-12
F[549] = -3.22264437357944E-12
F[550] = 0
F[551] = 3.49387185849537E-13
F[552] = 6.92668145063635E-13
F[553] = 1.80100379054693E-12
F[554] = 4.70068428626291E-13
F[555] = -8.77076189453874E-14
F[556] = -9.76996261670138E-14
F[557] = -1.65512048511118E-12
F[558] = 2.44138043115072E-13
F[559] = -5.63771251904654E-13
F[560] = 2.57349697108111E-13
F[561] = -1.59983137848485E-12
F[562] = 6.65023591750469E-14
F[563] = -6.02629057766535E-13
F[564] = -8.22675261247241E-14
F[565] = -7.04214464519737E-13
F[566] = 3.46833672892899E-13
F[567] = 1.42885703269258E-13
F[568] = 9.51461132103759E-13
F[569] = 8.70081784398735E-13
F[570] = 1.948885497427E-12
F[571] = -2.00173211339916E-13
F[572] = -4.86166662483356E-12
F[573] = 9.63673585374636E-14
F[574] = 5.72986103009043E-13
F[575] = 1.37834188507213E-12
F[576] = -2.89768209427166E-14
F[577] = -5.78248560145767E-12
F[578] = 2.73003841755326E-13
F[579] = 1.48758783069525E-12
F[580] = 5.82756065625745E-13
F[581] = -1.57684976187511E-12
F[582] = 1.65867319878998E-13
F[583] = -5.84199355557757E-13
F[584] = 2.59675614344701E-12
F[585] = 1.87683202312883E-13
F[586] = 1.48542289579723E-12
F[587] = -3.25295346215171E-13
F[588] = -1.55497836828999E-12
F[589] = -4.93993734806963E-13
F[590] = 2.60624855030756E-13
F[591] = -1.49635859258979E-12
F[592] = -4.96466756594316E-12
F[593] = 1.94691485155829E-12
F[594] = -9.60065360544604E-13
F[595] = 1.53613233244698E-12
F[596] = 6.28969099025767E-13
F[597] = 1.83275616905121E-12
F[598] = 6.50438036764456E-13
F[599] = 1.29060651055113E-12
F[600] = -1.2525243700285E-12
F[601] = -3.3435060275977E-13
F[602] = -1.93949023508111E-12
F[603] = -3.11098369287777E-13
F[604] = 6.23445739478257E-13
F[605] = 8.96699381414123E-13
F[606] = 1.3725964809197E-12
F[607] = -2.96532243204695E-12
F[608] = -5.88029624992714E-13
F[609] = -1.72806213782906E-13
F[610] = 4.876654635666E-13
F[611] = 8.70581384759817E-13
F[612] = -2.59342547437313E-12
F[613] = 8.10462807976364E-14
F[614] = -4.51305659510126E-13
F[615] = -9.289791158551E-13
F[616] = 2.01755279150007E-12
F[617] = 5.89306381471033E-13
F[618] = -1.01529895601971E-12
F[619] = 1.23201449042654E-12
F[620] = -3.25406368517633E-13
F[621] = 2.28483898467857E-13
F[622] = -4.03899136358632E-13
F[623] = 5.17130782640152E-12
F[624] = 5.66768854071142E-13
F[625] = 5.23359133808299E-13
F[626] = -3.79363207514416E-13
F[627] = -4.49418280368263E-13
F[628] = 1.48459022852876E-12
F[629] = 9.51017042893909E-13
F[630] = 9.89319737243477E-13
F[631] = 7.64943663966733E-13
F[632] = 4.00457444982294E-13
F[633] = 2.93876034618279E-13
F[634] = -4.49862369578113E-13
F[635] = 5.01720887058354E-12
F[636] = 1.09978692819368E-12
F[637] = -2.71227484915926E-13
F[638] = 1.32771571514922E-12
F[639] = 4.50306458787963E-13
F[640] = 1.13653531030877E-12
F[641] = -4.31099600461948E-13
F[642] = 2.05391259555654E-12
F[643] = -5.91748872125208E-13
F[644] = 1.7705836796722E-12
F[645] = 3.34732241924485E-13
F[646] = 2.28572716309827E-12
F[647] = 5.77138337121141E-12
F[648] = 3.78985731686043E-12
F[649] = 3.54627438525768E-12
F[650] = 200

F[850] = 200

F[850] and F[650] both have none 0s in them

12. Aug 25, 2013

### rbj

boy am i glad to read someone else say this (without consequence). i get all bloodied-up on the comp.dsp newsgroup when i push this (clear, IMO) fact. they call me a thought-fascist for insisting on that fact.

the language i might use (because some people object to my anthropomorphizing regarding the word "assumes", since the DFT is not a thinking being) is that the DFT periodically extends the finite sequence passed to it.

13. Aug 25, 2013

### jasonRF

I like your language - after posting I thought about editing to add a link to some periodic extension page somewhere, but got too lazy.

14. Aug 25, 2013

### jasonRF

No need to actually print 100s of lines of numbers! Anyway, I guess I should have specified that I was using $i = \sqrt{-1}$. Also, I meant to evaluate it at only 4 points, t = 0,1,2 and 3. This was to be in line with your first example that had only 4 points, only the DFT is particularly simple.

15. Aug 25, 2013

### btb4198

so what is wrong with my DFT ?

public void DFT()
{
int N2 = N-1;
for (int F3 = 0; F3 < R; F3++)
{
for (int K = 0; K <= N2; K++)
{
F[F3] = F[F3] + (Complex)DSP.ElementAt(K) * Complex.Exp(-Complex.ImaginaryOne * (Math.PI * 2 * F3 * K) / N);// Complex.FromPolarCoordinates(1, ((Math.PI * 2 * F3 *K) / N));
}

}
}

16. Aug 25, 2013

### jasonRF

I didn't say there was anything wrong with your DFT. I do think that you do not yet properly understand how the DFT works and what you should expect the output to look like for your example inputs. Note that the DFT typically takes N numbers and gives you back a different N numbers, so in the example I gave you the four numbers are
$$\begin{eqnarray} f(0) & = & 1 \\ f(1) & = & i \\ f(2) & = & -1 \\ f(3) & = & -i. \end{eqnarray}$$
Put that into your DFT and see what four numbers come out. The answer should be very simple.

jason

EDIT: in my equations above, I am using $i = \sqrt{-1}$.

Last edited: Aug 25, 2013