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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Samples per Cycle vs Frequency

Hello,

 

   I'm trying to determine the appropriate number of samples per cycle of a given frequency. My test setup uses an external clock to synchronize multiple measurements and devices. The vi seen below was designed to adjust the clock frequency based on the input test frequency and the samples per cycle. So I'm trying to figure out what the right number of samples per cycle would be for a wide range of potential test frequencies.(Say 100Hz to 200kHz)

 

Is there a general rule of thumb when coming up with a sample rate? Based on the vi below, can it be determined what the designer intended the sample rate to be?

 

I've searched throughout the code (I didn't write it) and haven't been able to discover where a sample rate calculation is taking place.

 

Thanks!

0 Kudos
Message 1 of 6
(2,641 Views)

For sinewaves, at least 10 samples per cycle are required to quantize the waveform into proper sine shape.

 

The higher the samples per cycle, the cleaner you can quantize your signal in the time domain.

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 6
(2,639 Views)

Look up "Nyquist frequency".  Your sampling frequency should be at least the Nyquist frequency of the highest frequency; the higher the better.  Within reason, of course.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 3 of 6
(2,637 Views)

Thanks for the reply!

 

So is it typical to use the same sample rate across a wide range of frequencies? Or is it desirable to use a higher sample rate at lower frequencies and a lower rate at higher frequencies?

 

I've seen instances in the code where the sample rate is changed based on the frequency, but I have yet to determine a pattern or formula that was used to get a samples per cycle value.

0 Kudos
Message 4 of 6
(2,633 Views)

@JayWW wrote:

So is it typical to use the same sample rate across a wide range of frequencies? Or is it desirable to use a higher sample rate at lower frequencies and a lower rate at higher frequencies?

 

I've seen instances in the code where the sample rate is changed based on the frequency, but I have yet to determine a pattern or formula that was used to get a samples per cycle value.


I would typically just use the maximum rate for the range of frequencies you care about.  It just makes it easier in code to only have the one sample rate.

 

The two rules of thumb are Nyquist (Fs>2x the max frequency), which is based on Frequency Domain analysis, and Fs>10x the max frequency, which is based more on time domain analysis.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 6
(2,618 Views)

@crossrulz wrote:

@JayWW wrote:

So is it typical to use the same sample rate across a wide range of frequencies? Or is it desirable to use a higher sample rate at lower frequencies and a lower rate at higher frequencies?

 

I've seen instances in the code where the sample rate is changed based on the frequency, but I have yet to determine a pattern or formula that was used to get a samples per cycle value.


I would typically just use the maximum rate for the range of frequencies you care about.  It just makes it easier in code to only have the one sample rate.

 

The two rules of thumb are Nyquist (Fs>2x the max frequency), which is based on Frequency Domain analysis, and Fs>10x the max frequency, which is based more on time domain analysis.


Thanks for tying our two posts together in a neat package.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 6
(2,597 Views)