LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Please, What is Happening Here?

Solved!
Go to solution

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:

  • What is happening here? That is exactly what is mathematical operation is happening and why?

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

 

0 Kudos
Message 1 of 8
(1,528 Views)

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?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 8
(1,522 Views)

@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!

0 Kudos
Message 3 of 8
(1,485 Views)

Sorry, new to posting to the forum...

 

The link in question is: 

Solved: FFT size unexpectedly affecting peak frequency - NI Community

 

Thank you,

John

0 Kudos
Message 4 of 8
(1,455 Views)

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.

 

  1. Help > Find Examples...
  2. (a new window will open)
  3. Browse according to: Task > Analysis, Signal Processing and Mathematics > FFT and Frequency Analysis

If you have any questions about those examples, start a new topic and it will be easier for everyone to follow along.

0 Kudos
Message 5 of 8
(1,412 Views)

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:

  • What is happening here? That is exactly what is mathematical operation is happening and why?

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

0 Kudos
Message 6 of 8
(1,359 Views)
Solution
Accepted by topic author JohnPatrick

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!)

0 Kudos
Message 7 of 8
(1,329 Views)

Thank you h for the clarification. That makes total sense.

 

I was able to answer the other two questions with some research.

 

John

0 Kudos
Message 8 of 8
(1,240 Views)