0
\$\begingroup\$

I am working on developing a Fourier transform for voltage readings. The goal is to determine voltages at different frequencies (frequency domain). I am taking readings at 100Hz and am measuring both the Average and TRMS voltages over time (time domain). For this question, I am only working with the "avg" data.

I have been utilizing the Fourier Analysis within Excel. I then utilize the =IMABS() function for each of the FFT (avg) values and divide by the amount of sample taken, 512 samples (i.e. =IMABS(FFT Value)/512). I then plot the results against the frequency (Hz).

Below is a table of example data. Apologies for the long list but the Fourier function in Excel only works with certain number of samples (i.e. 2, 4, 8,...256, 512, etc)

Attached is an image of the graph obtained when I graph just the avg values with respect to frequency.enter image description here

This is a new area for me so I'm hoping to get some insight, guidance, and make sure that I'm not overlooking something. I am also aware of the Nyquist theorem and am therefore not confident with any graphed voltages above 50Hz.

Time (sec.) Voltage (avg) Counter Freq. (Hz) FFT (avg) Amplitude (avg)
0.0000 -0.464 0 0 -229.039 0.447341797
0.0100 -0.521 1 0.195694716 10.1322200016599+1.645257812029i 0.020048688
0.0200 -0.401 2 0.391389432 9.65075248625337+2.76041332464675i 0.019605027
0.0300 -0.512 3 0.587084149 9.15268494359245+4.03087189358114i 0.019533161
0.0400 -0.44 4 0.782778865 8.25681453333612+5.27235979553822i 0.019133924
0.0500 -0.467 5 0.978473581 7.21324666201885+6.22104757994938i 0.018604206
0.0600 -0.519 6 1.174168297 6.07955964718428+6.93019294202941i 0.018005717
0.0700 -0.405 7 1.369863014 4.83143342629608+7.37208937173917i 0.017215271
0.0800 -0.512 8 1.56555773 3.59291030204946+7.57742009618472i 0.016379058
0.0900 -0.433 9 1.761252446 2.37433650922022+7.59420275947096i 0.015540468
0.1000 -0.47 10 1.956947162 1.15340023381173+7.33229089156102i 0.01449698
0.1100 -0.52 11 2.152641879 0.120712139467973+6.91156950591859i 0.013501218
0.1200 -0.405 12 2.348336595 -0.818067214278053+6.29386664644949i 0.012396112
0.1300 -0.516 13 2.544031311 -1.51563676527916+5.57318532827966i 0.011280468
0.1400 -0.427 14 2.739726027 -2.03711466482809+4.77308097389415i 0.010135973
0.1500 -0.473 15 2.935420744 -2.37469986904867+3.92829794114827i 0.008965402
0.1600 -0.516 16 3.13111546 -2.51483612661896+3.05848270837768i 0.007733664
0.1700 -0.408 17 3.326810176 -2.48721204893401+2.29485333429039i 0.006609698
0.1800 -0.522 18 3.522504892 -2.31824822704003+1.56731883117559i 0.005465527
0.1900 -0.42 19 3.718199609 -1.9729997846832+0.960300569731039i 0.004285721
0.2000 -0.478 20 3.913894325 -1.54872675438711+0.515919754555665i 0.00318828
0.2100 -0.512 21 4.109589041 -1.08489578685385+0.185004760673414i 0.002149525
0.2200 -0.407 22 4.305283757 -0.600187211577808+3.42696351333572E-002i 0.00117415
0.2300 -0.522 23 4.500978474 -0.141753016604165-1.5540399065834E-002i 0.00027852
0.2400 -0.416 24 4.69667319 0.290088046498194+5.29223345462406E-002i 0.00057593
0.2500 -0.483 25 4.892367906 0.637581694745883+0.270631882678479i 0.001352815
0.2600 -0.509 26 5.088062622 0.913697152631281+0.525795104052738i 0.002058952
0.2700 -0.408 27 5.283757339 1.07948700704762+0.877326776329355i 0.002716877
0.2800 -0.523 28 5.479452055 1.09431775695688+1.18413901721967i 0.003149148
0.2900 -0.414 29 5.675146771 1.04197490942795+1.49153138884348i 0.003553602
0.3000 -0.485 30 5.870841487 0.930424506303088+1.75894591194859i 0.003886464
0.3100 -0.507 31 6.066536204 0.700274984853021+1.98375634269125i 0.004108845
0.3200 -0.413 32 6.26223092 0.427036374279053+2.18627755520587i 0.004350767
0.3300 -0.522 33 6.457925636 0.114825551542406+2.30452647107527i 0.004506612
0.3400 -0.41 34 6.653620352 -0.251612518345346+2.25525310623467i 0.00443212
0.3500 -0.489 35 6.849315068 -0.485424402852134+2.06281583436469i 0.004138988
0.3600 -0.504 36 7.045009785 -0.786799114041862+1.99599329978933i 0.004190371
0.3700 -0.417 37 7.240704501 -0.980003621162694+1.72068507267303i 0.003867564
0.3800 -0.52 38 7.436399217 -1.13255633499022+1.50728840390684i 0.003682354
0.3900 -0.405 39 7.632093933 -1.21522126871698+1.18661576554237i 0.003317335
0.4000 -0.488 40 7.82778865 -1.17816222637269+0.911135070016272i 0.002908933
0.4100 -0.506 41 8.023483366 -1.16058223145583+0.593483129168018i 0.002545944
0.4200 -0.422 42 8.219178082 -0.977497440390513+0.338823108580408i 0.002020614
0.4300 -0.523 43 8.414872798 -0.815688606400097+0.173771044887206i 0.001628893
0.4400 -0.407 44 8.610567515 -0.602590140658854+4.03168948966772E-002i 0.001179565
0.4500 -0.481 45 8.806262231 -0.336934811223527-1.93959361379846E-002i 0.000659165
0.4600 -0.501 46 9.001956947 -0.136169857776244-7.50361244454022E-003i 0.00026636
0.4700 -0.426 47 9.197651663 6.02639217652264E-002+1.85540060806169E-002i 0.000123155
0.4800 -0.526 48 9.39334638 0.282481666820933+0.121647899267673i 0.000600706
0.4900 -0.402 49 9.589041096 0.413875144645062+0.323198016919613i 0.001025622
0.5000 -0.488 50 9.784735812 0.46382645002229+0.468359872354553i 0.001287428
0.5100 -0.494 51 9.980430528 0.512458090741133+0.692113347663311i 0.001681996
0.5200 -0.427 52 10.17612524 0.464175821857294+0.885410206930413i 0.001952549
0.5300 -0.527 53 10.37181996 0.392704495708325+1.00365121409194i 0.002104969
0.5400 -0.4 54 10.56751468 0.302381753466691+1.19598555887027i 0.002409412
0.5500 -0.488 55 10.76320939 9.41359784704656E-002+1.28098489205329i 0.00250867
0.5600 -0.492 56 10.95890411 -5.37145520510952E-002+1.33217729659522i 0.002604023
0.5700 -0.429 57 11.15459883 -0.284153335815369+1.33831690461504i 0.002672169
0.5800 -0.526 58 11.35029354 -0.479510056494082+1.23706803934805i 0.00259131
0.5900 -0.401 59 11.54598826 -0.588508197996208+1.14420786763055i 0.002513053
0.6000 -0.49 60 11.74168297 -0.750933338056818+1.02322392513199i 0.002478921
0.6100 -0.485 61 11.93737769 -0.845420982463707+0.850399701728216i 0.002342054
0.6200 -0.436 62 12.13307241 -0.872099113161632+0.688965118144201i 0.002170721
0.6300 -0.526 63 12.32876712 -0.867696056991852+0.510911890146492i 0.001966679
0.6400 -0.394 64 12.52446184 -0.846118361750733+0.312787409309037i 0.001761879
0.6500 -0.494 65 12.72015656 -0.700763258734886+0.223785630558508i 0.001436774
0.6600 -0.482 66 12.91585127 -0.594363584722293+4.34415449685877E-002i 0.001163963
0.6700 -0.441 67 13.11154599 -0.443418702758577-2.81778533350083E-002i 0.000867799
0.6800 -0.526 68 13.3072407 -0.274173268602233-7.75294764816895E-002i 0.000556493
0.6900 -0.393 69 13.50293542 -9.19087189277066E-002-3.67290016722993E-002i 0.000193312
0.7000 -0.494 70 13.69863014 8.35034877995999E-002-2.88689128021349E-002i 0.000172564
0.7100 -0.478 71 13.89432485 0.14501529433385+0.119597410589135i 0.00036713
0.7200 -0.445 72 14.09001957 0.228733084556724+0.235312617319269i 0.000640943
0.7300 -0.525 73 14.28571429 0.240052412637727+0.373773413956849i 0.000867618
0.7400 -0.398 74 14.481409 0.255815600480613+0.462556756670193i 0.001032389
0.7500 -0.49 75 14.67710372 0.251409383369858+0.627395398931579i 0.001320104
0.7600 -0.47 76 14.87279843 0.162566798954433+0.725722332958638i 0.001452554
0.7700 -0.45 77 15.06849315 0.104515512093105+0.834013887905941i 0.001641674
0.7800 -0.528 78 15.26418787 -2.0872726813188E-002+0.934920308584918i 0.001826471
0.7900 -0.399 79 15.45988258 -0.228172660942765+0.927106694266334i 0.001864789
0.8000 -0.495 80 15.6555773 -0.297715370895055+0.882984934377287i 0.00181997
0.8100 -0.464 81 15.85127202 -0.459154214398574+0.858790262541157i 0.00190201
0.8200 -0.454 82 16.04696673 -0.531759684345087+0.71193743420169i 0.001735562
0.8300 -0.528 83 16.24266145 -0.582897694831826+0.648138862991088i 0.001702531
0.8400 -0.401 84 16.43835616 -0.691101659464284+0.514854162590408i 0.0016832
0.8500 -0.503 85 16.63405088 -0.781199731191186+9.11054335093847E-002i 0.001536122
0.8600 -0.454 86 16.8297456 -0.65640093657412+0.436884039324661i 0.001540036
0.8700 -0.456 87 17.02544031 -0.711289955077337+0.215317467471172i 0.001451495
0.8800 -0.522 88 17.22113503 -0.523077156180344+6.50100020610644E-002i 0.001029495
0.8900 -0.404 89 17.41682975 -0.457063477012903+9.40734203869213E-002i 0.000911414
0.9000 -0.504 90 17.61252446 -0.401939026899766-3.82318024054948E-002i 0.00078858
0.9100 -0.45 91 17.80821918 -0.25558274486654-6.18114199989203E-002i 0.000513576
0.9200 -0.458 92 18.00391389 -0.198769059902799-5.67941326050739E-002i 0.000403757
0.9300 -0.523 93 18.19960861 -9.53852009466001E-003-9.94636251704868E-002i 0.000195156
0.9400 -0.402 94 18.39530333 0.118108733560192+0.174798543633572i 0.000412032
0.9500 -0.509 95 18.59099804 0.160432037943916+0.453369992858463i 0.000939294
0.9600 -0.447 96 18.78669276 4.47208878848853E-002+0.125845924705548i 0.000260851
0.9700 -0.462 97 18.98238748 -0.17915405379133+0.384195382993815i 0.000827955
0.9800 -0.522 98 19.17808219 -0.372308771368194-2.34528788216604E-002i 0.000728607
0.9900 -0.401 99 19.37377691 7.52035605307099E-002-1.36890952288607E-002i 0.000149296
1.0000 -0.512 100 19.56947162 -1.62976042411506-0.174785300615682i 0.003201379

. . . Table Cont'd

Time (sec.) Voltage (avg) Counter Freq. (Hz) FFT (avg) Amplitude (avg)
4.7500 -0.439 475 92.95499022 -0.980003621162715-1.72068507267302i 0.003867564
4.7600 -0.526 476 93.15068493 -0.786799114041881-1.99599329978933i 0.004190371
4.7700 -0.394 477 93.34637965 -0.485424402852159-2.06281583436469i 0.004138988
4.7800 -0.494 478 93.54207436 -0.25161251834537-2.25525310623467i 0.00443212
4.7900 -0.479 479 93.73776908 0.114825551542379-2.30452647107527i 0.004506612
4.8000 -0.446 480 93.9334638 0.427036374279046-2.18627755520587i 0.004350767
4.8100 -0.525 481 94.12915851 0.700274984852997-1.98375634269126i 0.004108845
4.8200 -0.398 482 94.32485323 0.93042450630307-1.7589459119486i 0.003886464
4.8300 -0.492 483 94.52054795 1.04197490942793-1.49153138884349i 0.003553602
4.8400 -0.47 484 94.71624266 1.09431775695686-1.18413901721968i 0.003149148
4.8500 -0.45 485 94.91193738 1.07948700704761-0.877326776329368i 0.002716877
4.8600 -0.528 486 95.10763209 0.913697152631271-0.525795104052749i 0.002058952
4.8700 -0.4 487 95.30332681 0.637581694745876-0.27063188267849i 0.001352815
4.8800 -0.495 488 95.49902153 0.290088046498189-5.29223345462469E-002i 0.00057593
4.8900 -0.465 489 95.69471624 -0.141753016604169+1.554039906583E-002i 0.00027852
4.9000 0 490 95.89041096 -0.600187211577812-3.42696351333574E-002i 0.00117415
4.9100 0 491 96.08610568 -1.08489578685386-0.185004760673409i 0.002149525
4.9200 0 492 96.28180039 -1.54872675438712-0.515919754555661i 0.00318828
4.9300 0 493 96.47749511 -1.97299978468321-0.960300569731027i 0.004285721
4.9400 0 494 96.67318982 -2.31824822704005-1.56731883117558i 0.005465527
4.9500 0 495 96.86888454 -2.48721204893404-2.29485333429037i 0.006609698
4.9600 0 496 97.06457926 -2.51483612661897-3.05848270837768i 0.007733664
4.9700 0 497 97.26027397 -2.37469986904871-3.92829794114825i 0.008965402
4.9800 0 498 97.45596869 -2.03711466482813-4.77308097389414i 0.010135973
4.9900 0 499 97.65166341 -1.51563676527921-5.57318532827965i 0.011280468
5.0000 0 500 97.84735812 -0.818067214278094-6.29386664644949i 0.012396112
5.0100 0 501 98.04305284 0.12071213946791-6.9115695059186i 0.013501218
5.0200 0 502 98.23874755 1.15340023381167-7.33229089156104i 0.01449698
5.0300 0 503 98.43444227 2.37433650922015-7.59420275947099i 0.015540468
5.0400 0 504 98.63013699 3.59291030204943-7.57742009618474i 0.016379058
5.0500 0 505 98.8258317 4.83143342629601-7.37208937173923i 0.017215271
5.0600 0 506 99.02152642 6.07955964718423-6.93019294202947i 0.018005717
5.0700 0 507 99.21722114 7.2132466620188-6.22104757994946i 0.018604206
5.0800 0 508 99.41291585 8.25681453333609-5.27235979553828i 0.019133924
5.0900 0 509 99.60861057 9.15268494359242-4.03087189358123i 0.019533161
5.1000 0 510 99.80430528 9.65075248625335-2.76041332464683i 0.019605027
5.1100 0 511 100 10.1322200016599-1.6452578120291i 0.020048688
\$\endgroup\$
4
  • \$\begingroup\$ What do you mean when you say you are taking average values at a 100 Hz rate. For Fourier Analysis you need to take the instantaneous values of the voltage at the time the sample is taken. Average values implies there is a time factor associated with each sample which will modify the Fourier Analysis. \$\endgroup\$
    – Barry
    Apr 19 at 22:17
  • \$\begingroup\$ This is a complicated subject. Nyquist applies, but also be aware that frequencies in your data above the Nyquist frequency will be aliased into your FFT as another frequency. You must remove these higher frequencies first. And you also may need to apply a window function such as Hamming before you perform the FFT. I recommend that you create some simulated data (start with sine waves) in Excel and put them through the FFT to gain more understanding. Note that without a window function, waves that are not an exact multiple of the sampling will have weird artifacts. \$\endgroup\$
    – Mattman944
    Apr 20 at 8:52
  • \$\begingroup\$ @Mattman944 are you talking about the amplitude(s) that are graphed beyond the Nyquist theorem (half of sampling rate)? If so I agree and plan to exclude this data from the graph all together. \$\endgroup\$ Apr 20 at 20:17
  • \$\begingroup\$ @Barry The "avg" values are an average of 3 readings which are each 1ms apart. So at a sample rate of 100Hz (10ms apart), data is read at, for example: 1.010, 1.011, and 1.012. These 3 readings are then averaged and the result is saved as a single point with a timestamp of 1.010. Therefore the "second" reading would be at 1.020, 1.021, 1.022, these would be averaged and the result is saved with a single timestamp of 1.020 \$\endgroup\$ Apr 21 at 19:00

1 Answer 1

1
\$\begingroup\$

The second half of the data output is not 50-100 Hz, it is a mirror of 0-50 Hz.

  1. Higher frequencies must be excluded before the FFT. Or else you get aliasing, the frequency is folded back. In the second picture, 60 Hz input appears as 40 Hz!

I created an Excel table similar to yours, except for the input data, instead I am inputting one or two sine waves.

enter image description here

60 Hz input: 40 Hz output! enter image description here

  1. Depending on the accuracy required, you may need to window the input. It is a complicated subject, there are books written on this. Wikipedia is a good start. A Hamming window is a popular choice.

If you have a single frequency where the wave exactly fits, you get a nice sharp output spike.

enter image description here

If the wave doesn't fit exactly, the output spectrum is not sharp, it is wide. Windowing will help this.

enter image description here

Here are the equations used to create the sample inputs. A sine wave = sin(2\$\pi\$ft), where f is the frequency and t is time.

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ Thank you so much for this breakdown @Mattman944 So if the result of the FFT doesn't present itself as a "sharp" spike, does this mean there is too much noise or other, very similar, frequencies occurring? Or does it just imply a result with low confidence? \$\endgroup\$ Apr 21 at 18:41
  • \$\begingroup\$ Whenever you measure a continous signal with a finite number of discrete samples there will be compromises. You need to understand the compromises and adjust your sampling method appropriately. When you put in a single frequency and get multiple frequencies out this is an example of the compromises. \$\endgroup\$
    – Mattman944
    Apr 21 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.