From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating FFT in dB

Looking to write a script to calculate FFT in dB. I ran across an old help topic that gave a calculator formula to do this:

 

Ch("[1]/AmplitudeDB") = 20*Lg(Ch("[1]/AmplitudePeak")/.01)

When I run this through the calculator under Analysis everything works as expected. The issue is when I try to run this via a script, I have to Call the Calculate Function, this still works, however it's much, much slower. It takes over a minute vs almost instantly when working from the calculator. The code I'm using:

 

Call Calculate("Ch(""[1]/AmplitudeDB"") = 20*Lg(Ch(""[1]/AmplitudePeak"")/.01)")

Any ideas on what could be causing the slowdown? Is there a better way to do this?

0 Kudos
Message 1 of 2
(2,307 Views)

Hi,

 

Often, these timing issues can be a result of the loading behavior that is chosen in settings. Take a look at the following option in settings:

 

2017-10-06 13 25 20.png

 

What is it set to currently? If you change this setting, does the calculation time change?

 

Alex C.

National Instruments

Alex C.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 2
(2,261 Views)