04-13-2022 03:41 PM
Hi Folks,
I was going through some old posts and member Dad posted a VI (thank you) that has me puzzled. His VI is attached.
1) After the FFT, the array is divided by the FFT size:
2) I do not understand what the Replace Array Subset is doing in this diagram (sorry for my ignorance).
3) Why must the Real Output be multiplied by 2 to get the proper amplitude? Where did it get scaled by 1/2?
If I remove the division in #1, I still get the tone in the correct place, but the Y scale reflects the Sample Size. I know this is something fundamental, but I am missing it by a mile.
Thank you!
John
Solved! Go to Solution.
04-13-2022 03:56 PM
I believe nobody except you and the member who posted the VI knows what you're talking of.
Could you please more details for us to understand and help you better?
04-13-2022 08:18 PM
@JohnPatrick wrote:
I was going through some old posts and member Dad posted a VI (thank you) that has me puzzled. His VI is attached.
There is nothing attached and nothing should be attached! That would be redundant!
All we need is a link to the old discussion. Please provide it!
04-14-2022 06:32 AM
Sorry, new to posting to the forum...
The link in question is:
Solved: FFT size unexpectedly affecting peak frequency - NI Community
Thank you,
John
04-14-2022 12:37 PM
That topic is nearly 10 years old (2012) and asks about a training module from 15 years earlier (1997). If you're trying to learn about FFTs in LabVIEW, I'd recommend completely ignoring both those things and checking out any of the examples that ship with LabVIEW.
If you have any questions about those examples, start a new topic and it will be easier for everyone to follow along.
04-15-2022 07:29 AM
Thank you OneofTheDans for the reply,
Yes the post and code are old, but I think my questions are still relevant, no?
I asked:
1) After the FFT, the array is divided by the FFT size:
When I remove this, I get spectrum in the correct place but the Y scale changes to reflect the FFT size. My guess is this is done to normalize the Y scale to the amplitude of the Sine generator - but I do not know that for sure and thus the question.
2) I do not understand what the Replace Array Subset is doing in this diagram (sorry for my ignorance).
This function appears to be replacing the element 1.95399E-16 (the value of the Real component at Index 0 multiplied by 2) with 0. Why is that? Is not the original number close enough to DC or does it have to be right-on? If right-on is the answer, then why?
Additionally, the Real component output is multiplied by 2. If the value of the Real component at Index 0 is 9.76996E-17, how does multiplying it by 2 achieve 1.95399E-16?
3) Why must the Real Output be multiplied by 2 to get the proper amplitude? Where did it get scaled by 1/2?
I do not understand where this amplitude became halved. I believe it to be intrinsic in the Transform, but simply would like confirmation.
Yes, I have looked at sample VIs and have constructed numerous scratch-built VIs in order to understand this. The Help files in the DSP Toolkit are not clear to me. I understand there might be another, even better way to implement this but was happy to have found this old VI for it does work. I am respectfully asking the community to explain this VI's workings, please.
Thank you,
John
04-15-2022 12:10 PM - edited 04-15-2022 12:11 PM
A value of 1.95399E-16 (assuming that the peaks are ~1E15 larger) IS zero.
DBLs only has a resolution of about 15 decimal digits and since FFTs involve a lot of calculations, rounding errors accumulate. Replacing these with zeroes is more a cosmetic thing than anything else. You could equally well just change the display format. You would never see the difference if e.g. graphed. (It's like the ratio between a meter and a lightyear!)
04-18-2022 03:46 PM
Thank you altenbach for the clarification. That makes total sense.
I was able to answer the other two questions with some research.
John