# Minimum sample length to estimate the frequency of a sinusoid

• A
• MisterH
In summary, the minimum number of consecutive points on a window required to correctly estimate the total length of a discretely sampled sinusoid of unknown amplitude is three, if the sampling rate is sufficiently high and there are no errors. However, in real-world situations, longer measurement windows may be needed to account for measurement uncertainties and deviations from a pure sine wave. Sampling at irrational ratios may not provide any advantage in terms of accuracy. Additionally, if three equally spaced points in time are co-linear, it is not possible to accurately identify the sinusoidal curve.
MisterH
TL;DR Summary
minimum window length to find the full length of a discretely sampled sinusoid?
Given a discretely sampled horizontal sinusoid of length p, and unknown amplitude, what is the minimal number of consecutive points on a window that is required to correctly estimate its total length, starting at any random point on the wave? Initially I would think it would be either p (full length), or p/2 (half length), right?

What if you found a method to correctly estimate its length p on only 3 sample points: would there be a commercial application for this?

Are you guaranteed that it is a noise-free pure sinusoid?

Yes

Then I would think it would be a pretty small number. Is there a reason that you have groups of 3 points in a row circled in the above plot?

MisterH said:
Summary:: minimum window length to find the full length of a discretely sampled sinusoid?

What if you found a method to correctly estimate its length p on only 3 sample points: would there be a commercial application for this?
The problem is that commercial applications involve real-world signals that are not pure sinusoids, and generally also involve some level of noise...

"Then I would think it would be a pretty small number. Is there a reason that you have groups of 3 points in a row circled in the above plot?"
-> just to illustrate that 1) it can be at any random point and 2) 3 is enough for my method.

"The problem is that commercial applications involve real-world signals that are not pure sinusoids, and generally also involve some level of noise..."
-> Indeed... But given the fact that the sinusoid is more or less the basic shape of nature, I'd think there's something I didn't think of, maybe related to electricity, or signal processing, etc., etc. I'm obviously not a physicist.

When you sample a signal, don't you have to sample at a freq twice the original? That would be a half wavelength which is what you originally thought.

"When you sample a signal, don't you have to sample at a freq twice the original? That would be a half wavelength which is what you originally thought."

-> If I understand it correctly, that's "Nyquist frequency", yes.

osilmag said:
When you sample a signal, don't you have to sample at a freq twice the original? That would be a half wavelength which is what you originally thought.
That's a different situation from what the OP asked originally, if I understood his question and graph:
MisterH said:
Summary:: minimum window length to find the full length of a discretely sampled sinusoid?

Given a discretely sampled horizontal sinusoid of length p, and unknown amplitude, what is the minimal number of consecutive points on a window that is required to correctly estimate its total length, starting at any random point on the wave?
It seemed to me that he was implying that the sampling rate was plenty high, he just wanted to be able tell everything about the sinusoid from just a few samples (like not waiting for a complete sinusoid to have to be sampled.

It depends on how much accuracy you require. The simple Nyquist frequency allows you to get complete accuracy from an infinite sample over an infinite time. Any finite time for the sample will not guarantee complete accuracy. The problem is that you are not guaranteed to get any sample at the exact zero of the sinusoidal. Anything else will give you a possible error for any finite sample.

There are only three degrees of freedom - amplitude, frequency and phase. From a purely mathematical point three samples are sufficient if you are guaranteed to sample at a sufficiently high rate with no errors. That's not a real-life situation of course, where you need to consider measurement uncertainties, deviations from a pure sine wave and so on. In that case longer measurement windows will lead to smaller uncertainties.

jasonRF, pbuk and berkeman
osilmag said:
When you sample a signal, don't you have to sample at a freq twice the original? That would be a half wavelength which is what you originally thought.
In each case the samples indicated in the graphic are ~10x~ the frequency of the original so this is not relevant.
mfb said:
There are only three degrees of freedom - amplitude, frequency and phase. From a purely mathematical point three samples are sufficient if you are guaranteed to sample at a sufficiently high rate with no errors. That's not a real-life situation of course, where you need to consider measurement uncertainties, deviations from a pure sine wave and so on. In that case longer measurement windows will lead to smaller uncertainties.
Hmmm, I think we need more information: the three points in the second set in the graphic could have come from a waveform at ~10x the frequency.

pbuk said:
Hmmm, I think we need more information: the three points in the second set in the graphic could have come from a waveform at ~10x the frequency.
I don't see that. How so?

First point (in the second group) at ## \frac{\pi}2 \phi - \epsilon ## second at ## 3 \frac{\pi}2 \phi ## third at ## 5 \frac{\pi}2 \phi + \epsilon ##?

That's the sampling at a sufficient rate I mentioned. We should be sure the period isn't smaller than our sampling distances.

I don't know if irrational ratios of sampling distances can break that ambiguity already, removing that restriction. What if we sample at times 0,a,b, with a/b irrational?

Putting aside the practical point that all floating point representations are rational (we are talking about digital sampling?), given that any irrational number can be approximated arbitrarily closely by a rational number I don't see how that could help even in theory: how would the processing engine (whether digital or analogue) tell the difference?

mfb said:
There are only three degrees of freedom - amplitude, frequency and phase. From a purely mathematical point three samples are sufficient if you are guaranteed to sample at a sufficiently high rate with no errors.
If I asked you to interpolate between three equally spaced points in time, using a sine curve, then how might you fit it ?
Note that if the points were co-linear; +v, 0 and -v, then it could not identify the frequency as the data is centred on a zero crossing.

pbuk
pbuk said:
Putting aside the practical point that all floating point representations are rational (we are talking about digital sampling?), given that any irrational number can be approximated arbitrarily closely by a rational number I don't see how that could help even in theory: how would the processing engine (whether digital or analogue) tell the difference?
As I said, this is a purely mathematical result. In real life you profit from a larger range.

@Baluncore: Yes, that's a special case where three points are not sufficient. Luckily your chance to hit this case is 0.

mfb said:
Yes, that's a special case where three points are not sufficient. Luckily your chance to hit this case is 0.
The theoretically impossible special case needs to be handled correctly by a practical algorithm.

Given a 16 bit A→D converter, the chance of hitting the impossible is better than 1/65k, and there is plenty of digitisation noise on either side of the infinite pitfall. I would expect the algorithm, running continuously, to fail at least once every second.

## 1. What is the minimum sample length needed to estimate the frequency of a sinusoid?

The minimum sample length needed to estimate the frequency of a sinusoid is typically at least 2-3 periods of the sinusoid. This ensures that enough data points are collected to accurately determine the frequency.

## 2. How does the sample length affect the accuracy of the frequency estimation?

The longer the sample length, the more accurate the frequency estimation will be. This is because a longer sample length allows for more data points to be collected, reducing the potential for errors or fluctuations in the data.

## 3. Is there a specific formula for determining the minimum sample length?

There is no specific formula for determining the minimum sample length for estimating the frequency of a sinusoid. It is generally recommended to use at least 2-3 periods of the sinusoid as a guideline, but the exact sample length may vary depending on the specific sinusoid being analyzed.

## 4. Can the minimum sample length be different for different types of sinusoids?

Yes, the minimum sample length may vary for different types of sinusoids. For example, a higher frequency sinusoid may require a longer sample length compared to a lower frequency sinusoid in order to accurately estimate its frequency.

## 5. Are there any other factors besides sample length that can affect the accuracy of frequency estimation for a sinusoid?

Yes, there are other factors that can affect the accuracy of frequency estimation for a sinusoid, such as noise in the data, the amplitude of the sinusoid, and the sampling rate. It is important to consider these factors when determining the minimum sample length needed for accurate frequency estimation.

### Similar threads

• General Math
Replies
1
Views
771
• General Math
Replies
12
Views
1K
• General Math
Replies
5
Views
940
• Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
• General Math
Replies
1
Views
5K
• General Math
Replies
2
Views
1K
• Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
• Calculus
Replies
7
Views
2K
• General Engineering
Replies
1
Views
832
• General Math
Replies
2
Views
982