Method for automatically determining proper sampling rate in sine wave sampling
By automatically adjusting the sine wave sampling rate, the resource waste and waveform incompleteness caused by inappropriate sampling rate are solved, and the collection of satisfactory sinearization is achieved, reducing the system resource requirements.
Patent Information
- Application Number
- CN202411047551.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-01
AI Technical Summary
In the prior art, there is a lack of effective methods for automatic determination of sine wave sampling rate, which leads to excessive or too small sampling rate, affecting the resource requirements of the acquisition system and the degree of sinening of the waveform.
A method is proposed to automatically determine the sine wave sampling rate. By first trying to acquire a piece of data, evaluating the degree of sinearization of its waveform. If you are not satisfied, you will find two maximum spectral peak frequencies in the frequency domain to construct a new sampling rate candidate set, and gradually adjust the sampling. rate until satisfactory sampling rate.
While ensuring the satisfactory sinearization degree of the sine waveform, it reduces the resource requirements of the acquisition system and avoids the dependence of manual trial and error.
Smart Images

Figure CN118884010A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a method for automatically determining an appropriate sampling rate in sine wave sampling.
[0002] Sine wave, as the simplest regular waveform, is a basic waveform type that the signal source must provide, and is widely used in the performance test of circuits and their impedance components. For a linear circuit system, if a sine wave is input, its normal output is also a sine wave. Using an oscilloscope to observe the input and output sine waves of the system is a basic test method for circuits or impedance components. An oscilloscope is essentially a data acquisition and display system. The acquisition of sinusoidal voltage signals requires an appropriate sampling rate. Excessive sampling rates mean excessive system resource requirements or occupation. Sine wave waveforms sampled at inappropriate sampling rates, when the sampling points are connected in the time domain, are not visually sinusoidal, ugly, and incomplete. Background Art
[0003] Time domain sampling theorem. A spectrally limited signal f(t) has a frequency spectrum that only occupies -f m ~+f m range, then the signal f(t) can be uniquely represented by equally spaced sampling values, and the sampling interval T s Must not be greater than 1 / (2f m ), that is, the sampling rate f s ≥2f m , the minimum sampling rate is 2f m .
[0004] For a sine wave, if we sample it according to the above sampling theorem, there are still some problems. If we sample exactly two points in one cycle of the sine wave, that is, f s =2f m , it is not necessarily possible to reconstruct the original sinusoidal signal. If the sampling rate f s >2f m But f s <10f m , then the collected sine wave will have poor sine wave shape and poor visual effect when observed in the time domain. If the sampling rate is much greater than the frequency of the sine wave, that is, f s >>10f m , then the resources of the acquisition system may not support it, or the acquisition system may not be necessary for high-end acquisition.
[0005] At present, no discussion has been found on the automatic determination of the appropriate sampling rate in sine wave sampling. In practice, oscilloscopes, etc., usually determine the appropriate sampling rate to display a complete sine wave through manual trial and error. Summary of the invention
[0006] Purpose of the Invention
[0007] A method for automatically determining the appropriate sampling rate in sine wave sampling is proposed.
[0008] Technical Solution
[0009] A method for automatically determining an appropriate sampling rate in sine wave sampling, characterized in that it comprises the following steps: (1) the acquisition system first uses a common sampling rate f s Try to collect a sufficiently long period of data and evaluate the f in the time domain or frequency domain. s The degree of sinusoidalization of the waveform of the collected data is determined to see if it is satisfactory. If it is satisfactory, the f s If the sampling rate is determined to be appropriate, the process ends. Otherwise, the following steps are executed; (2) s The FFT amplitude spectrum of the data collected for trial use is shown in the amplitude spectrum [0, f s ] Find two maximum peaks in the interval, less than f s / 2 is denoted as f0, and the other spectral peak frequency is f s -f0, based on which the following new sampling frequency f is constructed s′ Candidate Set
[0010]
[0011] (3) Try a new sampling rate f in the candidate set s′ Try to collect a sufficiently long period of sine wave data and evaluate it in the time domain or frequency domain. s′ The degree of sinusoidalization of the waveform of the collected data is determined to see if it is satisfactory. If it is satisfactory, the f s′ If the sampling rate is determined to be appropriate, the process ends; otherwise, continue to step (3) to try other new sampling rates.
[0012] According to the above method for automatically determining the appropriate sampling rate in sine wave sampling, step (1) evaluates the f in the time domain. s Whether the degree of sinusoidalization of the waveform of the collected data is satisfactory is characterized by obtaining the mean of the data. If the number of consecutive appearances of data points above the mean is approximately greater than or equal to 5 times, and the number of consecutive appearances of data points below the mean is also approximately greater than or equal to 5 times, then the degree of sinusoidalization of the waveform of the data is satisfactory, otherwise it is unsatisfactory.
[0013] According to the above method for automatically determining the appropriate sampling rate in sine wave sampling, step (1) evaluates the frequency domain according to f s Whether the waveform of the collected data is sinusoidal or not is satisfactory. The characteristic of this is that the FFT amplitude spectrum of this data is taken. In the amplitude spectrum [0, f s ] Find two maximum peaks in the interval, which is less than f s / 2 is denoted as f0. sIf the value of / f0 is approximately greater than 10, the waveform sinusoidalization of the data is considered satisfactory, otherwise it is unsatisfactory.
[0014] According to the above method for automatically determining the appropriate sampling rate in sine wave sampling, step (3) evaluates the value of f in the time domain. s′ Whether the degree of sinusoidalization of the waveform of the collected data is satisfactory is characterized by obtaining the mean of the data. If the number of consecutive appearances of data points above the mean is approximately greater than or equal to 5 times, and the number of consecutive appearances of data points below the mean is also approximately greater than or equal to 5 times, then the degree of sinusoidalization of the waveform of the data is satisfactory, otherwise it is unsatisfactory.
[0015] According to the above method for automatically determining the appropriate sampling rate in sine wave sampling, step (3) evaluates the frequency domain according to f s′ Whether the waveform of the collected data is sinusoidal or not is satisfactory. The characteristic of this is that the FFT amplitude spectrum of this data is taken. In the amplitude spectrum [0, f s′ ] Find two maximum peaks in the interval, which is less than f s′ / 2 is denoted as f0. s′ If the value of / f0 is approximately greater than 10, the waveform sinusoidalization of the data is considered satisfactory, otherwise it is unsatisfactory.
[0016] According to the above method for automatically determining the appropriate sampling rate in sine wave sampling, in step (3), a new sampling rate f is selected from the candidate set. s′ The selection is characterized by that the search can be performed in the following order until it is satisfactory: (a) First, set n0 = 0, n1 = 0, k = 10, which corresponds to the new sampling rate f s′ =10f0 or f s′ =10(f s -f0), if this f s′ If the system resources do not support it, n1 can be set to n1+1 until the system resources support f. s′ So far, when n1 = 1, take or (b) According to the new sampling rate f s′ Try sampling a sufficiently long period of data to evaluate the degree of sinusoidalization of the waveform; (c) If changing n1 does not find a satisfactory sampling rate, then n0 = n0 + 1 and continue with the new sampling rate f s′ Exploratory evaluation.
[0017] The above scheme is proposed based on the exploration and research of the following aspects in this application.
[0018] The sampling theorem determines the sampling rate based on the frequency of the signal, but the actual frequency of the sine wave is often unknown during actual sampling. At the same time, it is not so simple to analyze the actual frequency of the sine wave based on the spectrum. Assume that the sampling rate is f sTry to collect a section of data x of a sine wave n n=0,1,…,N-1,in its amplitude spectrum [0,f s ]There exist f0 and f s -f0, at this time, it is impossible to determine whether the actual frequency of the sine wave is f0 or (f s -f0) or f0+nf s or (f s -f0+nf s ), because there is such a derivation about sine wave sampling:
[0019] sin(2π(f0+n0f s )nT s )=sin(2πf0nT s +2πn0n)=sin(2πf0nT s )
[0020] sin(2π(f s -f0+n0f s )nT s )=-sin(2πf0nT s )
[0021] Among them, T s =1 / f s That is, when the sampling rate is f s When sampling a sine wave, there is the same amplitude spectrum, corresponding to an infinite number of sine waves of different frequencies. The set of these frequencies is:
[0022] B={f:f=f0+n0f s ∪f=(n0+1)f s -f0,n0∈0,1,…}
[0023] Obviously, the sampling of the sine wave does not necessarily follow the sampling rate f s >2f m The above sine wave frequency is f0+n0f s , when n0 is greater than 0, it means that the sampling rate f s A higher frequency, but you can also press f s Sampling is performed to obtain the magnitude information of the sine wave. The above sine wave frequency f s -f0, when f0<f s / 2, it is greater than f s / 2, nor does it satisfy f s >2f m You can also press f s Sample and obtain the size information of the sine wave.
[0024] This application conducted an experiment to adjust the frequency based on the following MATLAB program.
[0025] f=10;%40,70,100;20,50,80,110
[0026] fs=30; Ts=1 / fs;
[0027] N = 4096;
[0028] t=0:Ts:(N-1)*Ts;
[0029] x = sin(2*pi*f*t);
[0030] subplot(2, 1, 1)
[0031] plot(t(1:30),x(1:30))
[0032] X=abs(fft(x-mean(x)))*2 / N;
[0033] subplot(2, 1, 2)
[0034] plot((0:N-1)*fs / N,X(1:N))
[0035] Experiments have shown that for sine waves at f = 10 Hz, 40 Hz, 70 Hz or 100 Hz, the waveform and frequency spectrum of the sine wave sampled at fs = 30 Hz are the same, such as Figure 2 (a) As shown; for the sine wave at f = 20Hz, 50Hz, 80Hz or 110Hz, the waveform and bat spectrum of the sine wave sampled at fs = 30Hz are also the same, as shown in Figure 2 (b) as shown; at the same time, Figure 2 (a) and Figure 2 The amplitude spectrum of (b) is also the same.
[0036] The above experiment verifies the fact that the sine waves at all frequencies contained in the set B mentioned above have the same amplitude spectrum.
[0037] This application also conducted experiments based on the two Matlab programs shown in Table 1. Figure 3 (a) shows the results of the program execution of Experiment a in Table 1. Figure 3 (b) shows the results of the program execution of Experiment b in Table 1. Figure 3 (a) It can be seen that the 1Hz sine wave can obtain complete information about the waveform size of the sine wave by sampling at 20Hz or 20 / 21Hz. The sampling rate of 20 / 21Hz is less than the signal frequency of 1Hz, which does not satisfy the sampling theorem. Figure 3(b) It can be seen that when a 1 Hz sine wave is sampled at 20 Hz or 20 / 19 Hz, complete information about the waveform size of the sine wave can be obtained. Although the sampling rate of 20 / 19 Hz is greater than the signal frequency of 1 Hz, it does not satisfy the sampling theorem.
[0038] Table 1 and Figure 3 The experiment shown verifies the conclusion that under certain conditions, the complete information of the sine wave waveform size can be obtained even if the sampling theorem is not satisfied. This conclusion constitutes the feasibility of reducing the sampling rate and reducing the demand for system resources, and confirms the feasibility of selecting a new sampling frequency from set A in the previous article. The larger n1 in set A in the previous article, the smaller the sampling rate.
[0039] Table 1. Two experimental procedures for the impact of sampling theorem failure
[0040]
[0041] This application also Figures 4 to 6 The experiment shown. Figure 4 The experiment is to sample a 22Hz sine wave at 30Hz, and make a time domain waveform and amplitude spectrum diagram of the sampled sequence. Figure 4 The amplitude spectrum shows that there are two spectrum peaks at 8Hz and 22Hz. At this time, if we guess that the frequency of the sampled sine wave is 8Hz, and try sampling again at a sampling rate 10 times 80Hz, the waveform and amplitude spectrum of the sampled sequence are as follows: Figure 5 As shown. Figure 5 It can be seen that the 8Hz frequency guessed here is inconsistent with the real signal frequency of 22Hz. The sampling rate of 80Hz is less than 4 times of 22Hz. At the same time, the number of consecutive points above or below the mean of the time domain waveform is less than 3 points, and the sinusoidal degree of the waveform is not enough. Figure 4 The frequency of the sine wave shown is 22Hz, which is guessed correctly. If we try sampling again with a sampling rate 10 times that, i.e. 220Hz, the waveform and amplitude spectrum of the sampled sequence are as follows: Figure 6 As shown. Figure 6 It can be seen that the 22Hz frequency guessed here is the same as the real signal frequency of 22Hz, and the sampling rate of 220Hz is 10 times that of 22Hz. At the same time, the number of consecutive points above or below the mean of the time domain waveform is about more than 5 points, and the sinusoidal degree of the waveform has been improved. This experiment shows that if the frequency of a hypothetical sine wave from the previous set B matches the real frequency of the actual sine wave, the corresponding sampling rate can be selected from the previous set A to sample a sine wave with a satisfactory sinusoidal degree. Otherwise, if it does not match, the sinusoidal degree of the sampled sine wave may not be satisfactory. Therefore, the real frequency of the sine wave can be estimated based on the evaluation of the sinusoidal degree of the sampling sequence, and the corresponding appropriate sampling rate can be selected.
[0042] Beneficial effects.
[0043] A method for automatically determining the appropriate sampling rate in sinusoidal wave sampling is proposed, which breaks through the limitations of the sampling mode guided by the traditional sampling theorem. While ensuring that the time domain waveform of the sampled sine wave has a satisfactory degree of sinusoidalization, it can also minimize the demand or occupation of acquisition system resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 , a schematic diagram of the process of the present application method.
[0045] Figure 2 , an example diagram showing that the sampling signals of sine waves of multiple frequencies have the same waveform, especially the same amplitude spectrum.
[0046] Figure 3 , an example diagram showing that the sampling theorem is not satisfied but a complete sinusoidal waveform can be sampled.
[0047] Figure 4 , an example diagram of the waveform and amplitude spectrum of a sine wave sampling result.
[0048] Figure 5 , Figure 4 The waveform and amplitude spectrum diagram of the sine wave sampled at a new sampling rate is shown.
[0049] Figure 6 , Figure 4 The waveform and amplitude spectrum diagram of the sine wave sampled at an appropriate sampling rate is shown. DETAILED DESCRIPTION
[0050] Example.
[0051] Step (1): First, use a common sampling rate f s Try to sample a sufficiently long section of sine wave data, here the sampling rate is f s =30Hz, use sin(44πt) to simulate the sine wave, then the sequence obtained is sin(2*pi*22n / fs), see Figure 4 As shown, in the time domain, the number of consecutive points above or below the mean is less than 5, or in the frequency domain, the two spectrum peak frequencies 8 and 22 are both greater than f s 1 / 10 of the sample rate, the evaluation result is not satisfactory. At this time, the appropriate sampling rate has not been found, the process is not finished, and the following steps are executed; Step (2): Perform the sampling rate f in step (1) s The FFT amplitude spectrum of the data collected for the test is performed. s ] Find two maximum peaks in the interval, less than f s / 2 is denoted as f0, and the other peak frequency is f s -f0, here are 8Hz and 22Hz respectively, construct the following new sampling frequency f s′ Candidate Set
[0052]
[0053] Step (3) is to try a new sampling rate f in the candidate set. s′ Try sampling a sufficiently long period of data. Here, first use 80Hz for trial sampling (i.e., n0=n1=0, k=10, f s′ =10f0=80), the results are shown in Figure 5 As shown, in the time domain or frequency domain evaluation according to this f s′ The degree of sinusoidalization of the waveform of the collected data is not satisfactory, so we try 220Hz sampling (i.e., n0=n1=0, k=10, f s′ =10(f s -f0)=10*22=220), the results are shown in Figure 6 As shown, at this time, it is found that the degree of sinusoidalization of the waveform is satisfactory regardless of the time domain or frequency domain evaluation, so the attempted f s′ The process ends when the sampling rate is determined to be appropriate, which is 220 Hz here. Otherwise, continue with step (3), adjust n0 and n1, etc., and try other new sampling rates.
Claims
1. A method for automatically determining an appropriate sampling rate in sine wave sampling, characterized in that: The following steps are included: (1) the acquisition system first uses a common sampling rate f s Try to collect a sufficiently long period of data and evaluate the f in the time domain or frequency domain. s The degree of sinusoidalization of the waveform of the collected data is determined to see if it is satisfactory. If it is satisfactory, the f s If the sampling rate is determined to be appropriate, the process ends. Otherwise, the following steps are executed; (2) s The FFT amplitude spectrum of the data collected for the test is performed. s ] Find two maximum peaks in the interval, less than f s / 2 is denoted as f0, and the other peak frequency is f s -f0, based on which the following new sampling frequency f is constructed s′ Candidate Set (3) Try a new sampling rate f in the candidate set s′ Try to collect a sufficiently long period of sine wave data and evaluate it in the time domain or frequency domain. s′ The degree of sinusoidalization of the waveform of the collected data is determined to see if it is satisfactory. If it is satisfactory, the f s′ If the sampling rate is determined to be appropriate, the process ends; otherwise, continue to step (3) to try other new sampling rates.
2. According to the method for automatically determining the appropriate sampling rate in sine wave sampling in claim 1, step (1) evaluates the sampling rate in the time domain according to f s Whether the waveform sinusoidal degree of the collected data is satisfactory is characterized by: Find the mean of this section of data. If the number of consecutive appearances of data points above the mean is approximately greater than or equal to 5 times, and the number of consecutive appearances of data points below the mean is approximately greater than or equal to 5 times, then the sinusoidalization degree of the data waveform is satisfactory, otherwise it is unsatisfactory.
3. The method for automatically determining an appropriate sampling rate in sine wave sampling according to claim 1, wherein step (1) evaluates the frequency domain according to f s Whether the waveform sinusoidal degree of the collected data is satisfactory is characterized by: Perform FFT amplitude spectrum on this data. s ] Find two maximum peaks in the interval, which is less than f s / 2 is recorded as f0. If f s If the value of / f0 is approximately greater than 10, the waveform sinusoidalization of the data is considered satisfactory, otherwise it is unsatisfactory.
4. According to the method for automatically determining the appropriate sampling rate in sine wave sampling in claim 1, step (3) evaluates the sampling rate in the time domain according to f s′ Whether the waveform sinusoidal degree of the collected data is satisfactory is characterized by: Find the mean of this section of data. If the number of consecutive appearances of data points above the mean is approximately greater than or equal to 5 times, and the number of consecutive appearances of data points below the mean is approximately greater than or equal to 5 times, then the sinusoidalization degree of the data waveform is satisfactory, otherwise it is unsatisfactory.
5. According to the method for automatically determining the appropriate sampling rate in sine wave sampling in claim 1, step (3) evaluates the frequency domain according to f s′ Whether the waveform sinusoidal degree of the collected data is satisfactory is characterized by: Perform FFT amplitude spectrum on this data. s′ ] Find two maximum peaks in the interval, which is less than f s′ / 2 is recorded as f0. If f s′ If the value of / f0 is approximately greater than 10, the waveform sinusoidalization of the data is considered satisfactory, otherwise it is unsatisfactory.
6. According to the method for automatically determining the appropriate sampling rate in sine wave sampling in claim 1, step (3) selects a new sampling rate f from the candidate set s′ The selection is characterized by: You can search in the following order until you are satisfied: (a) First set n0 = 0, n1 = 0, k = 10, which corresponds to the new sampling rate f s′ =10f0 or f s′ =10(f s -f0), if this f s′ If the system resources do not support it, n1 can be set to n1+1 until the system resources support f. s′ So far, when n1 = 1, take or (b) According to the new sampling rate f s′ Try sampling a sufficiently long period of data to evaluate the degree of sinusoidalization of the waveform; (c) If changing n1 does not find a satisfactory sampling rate, then n0 = n0 + 1 and continue with the new sampling rate f s′ Exploratory evaluation.
