Peak and valley determination method, apparatus and electronic device for signal
By combining the differential solution method of polynomial functions and discrete sampling points, the target peak and valley values of the signal are screened out, solving the problem of inaccurate peak and valley extraction in complex noise environments and realizing accurate signal analysis.
Patent Information
- Application Number
- CN202311108034.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-30
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2043-08-30
AI Technical Summary
Existing methods cannot effectively extract the peaks and troughs of signals in complex noisy environments, resulting in inaccurate detection results.
By combining the difference solution method of polynomial function and discrete sampling points, the target peak and valley values of the signal are screened out. This includes fitting the polynomial function based on Taylor regression function, performing second derivative, and combining first-order difference operation and weighted moving average filtering method for noise processing.
Accurately solving for the peak and trough values of finite sequence periodic signals in complex noisy environments improves the accuracy of signal analysis and judgment.
Smart Images

Figure CN117194892B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital signal technology, and more specifically to a method for determining the peak and valley values of a signal, a device for determining the peak and valley values of a signal, and an electronic device. Background Technology
[0002] In digital signal processing, it is often necessary to find or solve for the peaks (or troughs) of a specified sampled signal sequence. For example, the sampled signal sequence can be voltage, current, or power signals in a power system, as well as various vibration signals related to human life and movement, such as respiratory rate, pulse, blood pressure, blood oxygen saturation, and step count.
[0003] Currently, methods for measuring peaks and troughs include: comparison discrimination method, first-order difference combined with comparison discrimination method, and second-order difference discrimination method. However, these three methods cannot extract effective peaks and troughs for signals with complex noise, and cannot discard noise signals, resulting in inaccurate detection results. In real-world scenarios, this can cause unnecessary losses and consequences. Summary of the Invention
[0004] The purpose of this invention is to provide a method, a device, and an electronic device for determining the peak and valley values of a signal, in order to solve the shortcomings of existing methods in extracting effective peaks and valleys from signals with complex noise.
[0005] To achieve the above objectives, embodiments of the present invention provide a method for determining the peak and valley values of a signal, comprising:
[0006] Obtain the signal frequency of the signal to be measured;
[0007] Multiple sampling points within a single period of the signal under test are determined based on the signal frequency and the preset sampling frequency.
[0008] A polynomial function is formed by fitting the multiple sampling points, and a first candidate peak value and a first candidate valley value are determined based on the polynomial function.
[0009] Based on the multiple sampling points, the differential solution of discrete sampling points is performed to determine the second candidate peak value and the second candidate valley value;
[0010] The maximum value among the first candidate peak value and the second candidate peak value is determined as the target peak value of the signal to be tested, and the maximum value among the first candidate valley value and the second candidate valley value is determined as the target valley value of the signal to be tested.
[0011] Optionally, the step of fitting a polynomial function based on the plurality of sampling points, and determining the first candidate peak and the first candidate valley based on the polynomial function, includes:
[0012] The multiple sampling points are fitted using a Taylor regression function to form a polynomial function;
[0013] The first candidate peak value and the first candidate valley value are determined based on the second derivative of the polynomial function.
[0014] Optionally, the fitting of the multiple sampling points based on the Taylor regression function to form a polynomial function includes:
[0015] The Taylor regression function is used to approximate the sign equation of multiple sampling points;
[0016] Based on the low-order polynomials of the symbolic equation, feature discrimination is performed to obtain the functional features of the symbolic equation;
[0017] A polynomial function is formed based on the aforementioned functional characteristics.
[0018] Optionally, the step of performing differential calculations on the discrete sampling points based on the plurality of sampling points to determine the second candidate peak value and the second candidate valley value includes:
[0019] A sampling vector is formed by concatenating multiple sampling points;
[0020] A first-order difference vector is calculated based on the sampling vector;
[0021] A trend vector is obtained by performing a sign function operation based on the first-order difference vector;
[0022] Iterate through the trend vectors and reassign values;
[0023] A first-order difference operation is performed on the reassigned trend vector to obtain the difference vector;
[0024] The second candidate peak and the second candidate valley are determined based on the difference vector.
[0025] Optionally, after the steps of determining the maximum or minimum value among the first candidate peak value and the second candidate peak value as the target peak value of the signal under test, and determining the maximum or minimum value among the first candidate valley value and the second candidate valley value as the target valley value of the signal under test, the method further includes:
[0026] The accuracy of the target peak value and the target valley value is verified by comparing each adjacent value within a set neighborhood of the target peak value with the target peak value, and by comparing each adjacent value within a set neighborhood of the target valley value with the target valley value.
[0027] Optionally, before the step of acquiring the signal frequency of the signal to be measured, the method further includes:
[0028] The signal under test is smoothed and denoised using a weighted moving average filtering method.
[0029] On the other hand, embodiments of the present invention also provide a device for determining the peak and valley values of a signal, comprising:
[0030] The signal frequency acquisition module is used to acquire the signal frequency of the signal under test.
[0031] The sampling point determination module is used to determine multiple sampling points within a single period of the signal under test based on the signal frequency and a preset sampling frequency.
[0032] The first peak-valley value determination module is used to fit a polynomial function based on the multiple sampling points, and to determine the first candidate peak value and the first candidate valley value based on the polynomial function.
[0033] The second peak-valley value determination module is used to perform differential solution of discrete sampling points based on the multiple sampling points to determine the second candidate peak value and the second candidate valley value.
[0034] The target peak-valley value determination module is used to determine the maximum value among the first candidate peak value and the second candidate peak value as the target peak value of the signal under test, and to determine the maximum value among the first candidate valley value and the second candidate valley value as the target valley value of the signal under test.
[0035] Optionally, the step of fitting a polynomial function based on the plurality of sampling points, and determining the first candidate peak and the first candidate valley based on the polynomial function, includes:
[0036] The multiple sampling points are fitted using a Taylor regression function to form a polynomial function;
[0037] The first candidate peak value and the first candidate valley value are determined based on the second derivative of the polynomial function.
[0038] Optionally, the fitting of the multiple sampling points based on the Taylor regression function to form a polynomial function includes:
[0039] The Taylor regression function is used to approximate the sign equation of multiple sampling points;
[0040] Based on the low-order polynomials of the symbolic equation, feature discrimination is performed to obtain the functional features of the symbolic equation;
[0041] A polynomial function is formed based on the aforementioned functional characteristics.
[0042] Optionally, the step of performing differential calculations on the discrete sampling points based on the plurality of sampling points to determine the second candidate peak value and the second candidate valley value includes:
[0043] A sampling vector is formed by concatenating multiple sampling points;
[0044] A first-order difference vector is calculated based on the sampling vector;
[0045] A trend vector is obtained by performing a sign function operation based on the first-order difference vector;
[0046] Iterate through the trend vectors and reassign values;
[0047] A first-order difference operation is performed on the reassigned trend vector to obtain the difference vector;
[0048] The second candidate peak and the second candidate valley are determined based on the difference vector.
[0049] Optionally, the peak and valley determination device for the signal further includes:
[0050] The verification module is used to compare each adjacent value within a set neighborhood of the target peak with the target peak, and to compare each adjacent value within a set neighborhood of the target valley with the target valley, so as to verify the accuracy of the target peak and the target valley.
[0051] Optionally, the peak and valley determination device for the signal further includes:
[0052] The smoothing and denoising module is used to perform smoothing and denoising processing on the signal under test based on the weighted moving average filtering method.
[0053] On the other hand, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method for determining the peak and valley values of the signal as described above.
[0054] On the other hand, the present invention also provides a machine-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for determining the peak and valley values of the signal as described above.
[0055] On the other hand, the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the method for determining the peak and valley values of the signal as described above.
[0056] Through the above technical solution, the present invention selects the target peak value and target valley value as the maximum value from the candidate peak and valley values determined by the polynomial function and the candidate peak and valley values obtained by the difference solution of discrete sampling points. Thus, by combining the peak and valley value solution method of continuous waveform and the peak and valley value solution method of discrete sampling points, the peak and valley values of finite sequence periodic signals can be accurately solved in complex noise environments.
[0057] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description section. Attached Figure Description
[0058] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings:
[0059] Figure 1 This is one of the flowcharts illustrating the method for determining the peak and valley values of a signal provided by the present invention;
[0060] Figure 2 This is the second flowchart illustrating the method for determining the peak and valley values of a signal provided by the present invention;
[0061] Figure 3 This is the third flowchart illustrating the method for determining the peak and valley values of a signal provided by this invention;
[0062] Figure 4 This is a schematic diagram of the structure of the signal peak and valley determination device provided by the present invention;
[0063] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0064] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the scope of the present invention.
[0065] Method Implementation Examples
[0066] Please refer to Figure 1 This invention provides a method for determining the peak and valley values of a signal, comprising:
[0067] Step 200: Obtain the signal frequency of the signal to be tested.
[0068] Electronic devices acquire the signal frequency of the signal to be measured. The signal to be measured can be voltage, current, or power signals from a power system, as well as various vibration signals related to human life and movement, such as respiratory rate, pulse, blood pressure, blood oxygen saturation, and step count.
[0069] In one embodiment, the electronic device can obtain the frequency and amplitude of the signal under test by performing a Fast Fourier Transform on the signal under test and analyzing the frequency components in the spectrum. In another embodiment, the electronic device can also obtain the signal frequency of the signal under test based on the method mentioned in Chinese Invention Patent Application No. CN201910573020.0, entitled "Fast Fixed-Point Frequency Offset Measurement Method".
[0070] Step 300: Determine multiple sampling points within a single cycle of the signal under test based on the signal frequency and the preset sampling frequency.
[0071] Given a fixed signal frequency, the electronic device can determine multiple sampling points within a single period of the signal under test based on the signal frequency and a preset sampling frequency. Specifically, the number M1 of multiple sampling points can be determined by the following formula:
[0072]
[0073] Where M1 is the number of sampling points determined in a single period, f s For the preset sampling frequency, f x Let P be the signal frequency. Based on the number of sampling points M1, assume that the sampling points within a single period of the signal under test are as follows: P -1 P0, P1, ..., P i , ...,
[0074] Step 400: Fit a polynomial function based on the multiple sampling points, and determine the first candidate peak value and the first candidate valley value based on the polynomial function.
[0075] The electronic device fits a polynomial function based on the multiple sampling points. That is, the electronic device fits a continuous waveform curve based on multiple sampling points, and then determines the first candidate peak value and the first candidate valley value based on the polynomial function representing the continuous waveform curve.
[0076] Step 500: Based on the multiple sampling points, perform differential calculation of the discrete sampling points to determine the second candidate peak value and the second candidate valley value.
[0077] The electronic device determines the second candidate peak value and the second candidate valley value by performing a differential solution on the discrete sampling points based on the multiple sampling points. That is, the electronic device determines the second candidate peak value and the second candidate valley value by using a differential solution method for discrete sampling points that is different from the polynomial function solution.
[0078] Step 600: Determine the maximum value among the first candidate peak value and the second candidate peak value as the target peak value of the signal to be tested; determine the maximum value among the first candidate valley value and the second candidate valley value as the target valley value of the signal to be tested.
[0079] When an electronic device uses a combination of polynomial function and differential calculation of discrete sampling points to select candidate peak and valley values (i.e., first candidate peak value, first candidate valley value, second candidate peak value, and second candidate valley value) from two aspects, the target peak value of the signal under test is determined by identifying the maximum value between the first and second candidate peak values, and the target valley value is determined by identifying the maximum value between the first and second candidate valley values. For example, if the signal under test is a current signal, and the first candidate peak value is 80mA and the second candidate peak value is 90mA, then the electronic device selects the second candidate peak value as the target peak value. Similarly, if the first candidate valley value is 1mA and the second candidate valley value is 0mA, then the electronic device selects the second candidate valley value as the target valley value.
[0080] Thus, by comparing the two methods, the accurate peak and valley values of a finite-sequence periodic signal are obtained. The optimal target peak and valley values are determined from the candidate peak and valley values obtained by combining polynomial function and discrete sampling point differential solutions. This overcomes the shortcomings of using a single polynomial function or discrete sampling point differential solutions for peak and valley values. This invention integrates both methods to accurately solve for the peak and valley values of a finite-sequence periodic signal in complex noisy environments, providing a strong guarantee for signal analysis and judgment.
[0081] By selecting the target peak and valley values as the maximum and minimum values from the candidate peak and valley values determined by the polynomial function and the candidate peak and valley values obtained by the difference solution of discrete sampling points, the peak and valley values of finite sequence periodic signals can be accurately solved in complex noise environments by combining the peak and valley value solution methods of continuous waveforms and discrete sampling points, thus providing a strong guarantee for signal analysis and judgment.
[0082] In other aspects of the embodiments of the present invention, step 400, fitting a polynomial function based on the plurality of sampling points, and determining a first candidate peak value and a first candidate valley value based on the polynomial function, includes:
[0083] Step 410: Fit the multiple sampling points based on the Taylor regression function to form a polynomial function.
[0084] The electronic device can fit the multiple sampling points based on the Taylor regression function to form a polynomial function, thereby forming a continuous waveform curve by fitting the multiple sampling points through the polynomial function.
[0085] Step 420: Perform a second derivative based on the polynomial function, and determine the first candidate peak value and the first candidate valley value based on the result of the second derivative.
[0086] Electronic devices determine the first candidate peak and the first candidate valley by taking the second derivative of a polynomial function. Specifically, for example, the polynomial function is... Then, take the first derivative of the above polynomial function and find the point (i, P) where the derivative is 0. i Based on i-point pairs Find the second derivative and determine If the value of is 0, then i is a stationary point; if it is greater than 0, then P is a stationary point. i The first candidate valley value is P; if it is less than 0, then P... i It is the first candidate peak value.
[0087] It should be noted that in other embodiments, waveform curve fitting can also be performed on the plurality of sampling points using other methods. For example, waveform curve fitting can be performed on the plurality of sampling points using the least squares method.
[0088] In this embodiment of the invention, the multiple sampling points are fitted using a Taylor regression function to form a polynomial function. The polynomial function is then differentiated twice, and the first candidate peak value and the first candidate valley value are determined based on the result of the second differentiation. Thus, the first candidate peak value and the first candidate valley value are obtained through a continuous polynomial function, providing a good prerequisite for judging the target peak value and the target valley value.
[0089] In other aspects of the embodiments of the present invention, step 410, fitting the plurality of sampling points based on the Taylor regression function to form a polynomial function, includes:
[0090] Step 411: Use the Taylor regression function to approximate the symbolic equation of multiple sampling points.
[0091] Step 412: Perform feature discrimination based on the low-order polynomial of the symbolic equation to obtain the function features of the symbolic equation.
[0092] Step 413: Form a polynomial function based on the aforementioned function characteristics.
[0093] The electronic device fits waveform curves using a Taylor regression function, which approximates a symbolic equation at multiple sampling points using a Taylor polynomial. Based on the low-order polynomial of the symbolic equation, the electronic device performs feature discrimination to obtain the functional features of the symbolic equation. These functional features include variable separability, boundary conditions, monotonicity, and parity. The electronic device then forms a polynomial function based on these functional features. In one embodiment, the formula for the polynomial function is: θ is the target parameter set. The expression for the estimated polynomial function, The values for the estimated points. The range of the dataset D, consisting of multiple sampled points, is within... x is the x-coordinate of the sampling point, i is the index of the sampling point, and P is the y-coordinate of the sampling point.
[0094] In one embodiment, step 410 is performed as follows:
[0095] In a dataset D with multiple sampling points, select k points (x1, P1), (x1, P2), ..., (x1, P2) around (x0, P0). k P k Based on the selected k points, k k-th order Taylor polynomials are aggregated using the following formula:
[0096]
[0097] In the formula f(x) i ) = P i Then via F=CA -1 The formula yields the k-th derivative, where F = [f′(a), f″(a), ..., f k (a)] T , C=[P1-P0, P1-P0,...,P k -P0],a ij ∈A and The final calculated F can generate a k-th order Taylor polynomial.
[0098]
[0099] For a Taylor polynomial, if the coefficients of all multivariable terms are zero, then the function approximated by the Taylor polynomial is additively separable. The Taylor polynomial described above is then decomposed into multiple sub-Taylor polynomials, and the sub-Taylor polynomials are evaluated: if they are low-order polynomials, they can be directly expressed mathematically; otherwise, their monotonicity, parity, and boundary conditions are calculated.
[0100] Then, the function characteristics are evolved, and individual initialization and individual recombination operations are performed. The individual initialization operator randomly generates individuals that satisfy the function characteristics. The individual recombination operator transforms the individuals to ensure that the generated individuals satisfy the function characteristics. In each generation, offspring are generated using individual recombination with probability α; offspring are generated using individual initialization with probability β; and individuals are saved as other offspring with probability (1-α-β).
[0101] Individual initialization consists of three steps: segmenting the mathematical expression space, evaluating subspaces, and generating individuals. Segmenting the mathematical expression space uses a tree of depth h to represent a spatial segment of the mathematical expression. For example, given a set of basis functions {+, sin} and a set of variables {x, c}, the mathematical expression space is divided into tree-encoded subspaces of depth 3, including "++sincxx", "+++xcc", "+sinsinxx", and "sin+xc". Evaluating the subspaces determines their boundaries, monotonicity, and parity. The individual generation method obtains segmented subspaces whose boundaries contain the given boundaries. Then, a subspace is randomly selected from these subspaces. If a subspace does not meet the given monotonicity and parity requirements, the method randomly generates a new individual from the subspace until the given function characteristics are met.
[0102] Individual recombination involves recombining two individuals in space to construct individuals that satisfy a given function characteristic, and then assembling the combination into a mathematical expression.
[0103] Assembling mathematical expressions simply involves combining the mathematical expressions found by each simple Taylor polynomial into various complete mathematical equations, which can be summarized as follows:
[0104] In other aspects of the embodiments of the present invention, step 500, performing a differential solution on the discrete sampling points based on the plurality of sampling points to determine the second candidate peak value and the second candidate valley value, includes:
[0105] Step 510: Form a sampling vector by splicing multiple sampling points.
[0106] Specifically, electronic devices are based on multiple sampling points concatenated into a one-dimensional sampling vector.
[0107] Step 520: Calculate the first-order difference vector based on the sampling vector.
[0108] The electronic device calculates the first-order difference vector Diff based on the sampling vector V. v The formula for calculating each element in the first-order difference vector is as follows: Diff v (i)=V(i)-V(i-1); where i∈0,1,2,3...N.
[0109] Step 530: Perform a sign function operation based on the first-order difference vector to obtain the trend vector.
[0110] Electronic devices for first-order difference vectors Diff v Perform a sign function operation to obtain the trend vector Trend. The formula for calculating the trend vector Trend is Trend = sign(Diff).v ).
[0111] in,
[0112] Step 540: Iterate through the trend vectors and reassign values.
[0113] Specifically, the electronic device traverses the trend vector Trend from the tail and performs the following operations: if Trend(i) = 0 and Trend(i+1) ≥ 0, then Trend(i) = 1; if Trend(i) = 0 and Trend(i+1) < 0, then Trend(i) = -1.
[0114] Step 550: Perform a first-order difference operation on the reassigned trend vector to obtain the difference vector.
[0115] The electronic device performs a first-order difference operation on the reassigned trend vector Trend to obtain a difference vector R. The formula for the difference vector R is: R = Diff Trend (i).
[0116] Step 560: Determine the second candidate peak value and the second candidate valley value based on the difference vector.
[0117] The difference vector R obtained by traversing the electronic device, if R(i) = -2, then i+1 is the peak position of the waveform, and P i+1 This is the second candidate peak; if R(i) = 2, then i+1 is the trough of the waveform, and P i+1 It is the second candidate valley value.
[0118] This invention employs a first-order difference method based on discrete sampling points to determine the selected second candidate peak and second candidate valley values. Thus, the second candidate peak and second candidate valley values obtained through the difference solution of discrete sampling points provide a good prerequisite for determining the target peak and target valley values.
[0119] For other aspects of the embodiments of the present invention, please refer to Figure 2 After step 600, which involves determining the maximum or minimum value among the first candidate peak value and the second candidate peak value as the target peak value of the signal to be tested, and determining the maximum or minimum value among the first candidate valley value and the second candidate valley value as the target valley value of the signal to be tested, the method further includes:
[0120] Step 700: Compare each adjacent value within a set neighborhood of the target peak value with the target peak value, and compare each adjacent value within a set neighborhood of the target valley value with the target valley value, to verify the accuracy of the target peak value and the target valley value.
[0121] The electronic device compares each adjacent value within a set neighborhood of the target peak value in the signal under test with the target peak value to verify the accuracy of the target peak value. For example, the electronic device compares the first 5 and last 5 adjacent values of the target peak value in the signal under test, a total of 10 adjacent values, with the target peak value to verify the accuracy of the selected target peak value. This further verifies the target peak value, ensuring that the selected target peak value does indeed belong to the peak value of the signal under test.
[0122] Similarly, the electronic device compares the first five and last five adjacent values of the target valley value in the signal under test, for a total of ten values, with the target valley value to verify the accuracy of the selected target valley value. This further verifies the target valley value, ensuring that the selected target valley value does indeed belong to the valley value of the signal under test.
[0123] By comparing each adjacent value within a set neighborhood of the target peak with the target peak, and by comparing each adjacent value within a set neighborhood of the target valley with the target valley, the accuracy of the target peak and valley is further verified, ensuring that the selected target peak does indeed belong to the peak and valley of the signal under test.
[0124] For other aspects of the embodiments of the present invention, please refer to Figure 3 Before step 200, which involves acquiring the signal frequency of the signal to be measured, the following steps are also included:
[0125] Step 100: Perform smoothing and noise reduction processing on the signal under test based on the weighted moving average filtering method.
[0126] To reduce the impact of noise on the determination of the peak and trough values of the signal under test, the electronic device performs smoothing and noise reduction processing on the signal under test based on the weighted moving average filtering method. Specifically, this embodiment of the invention uses the weighted moving average filtering method to smooth and denoise the P signal. -1 P0, P1, ..., P i P N-1 The sampling sequence eliminates noise signals from short-term fluctuations. Its working principle is based on the characteristic that more recent data has a greater impact on the predicted value, and it treats each data point within the moving average differently. More recent data is given a larger weight, and more distant data is given a smaller weight. This allows for a point-by-point shift and segment-by-segment averaging, smoothing out irregular data points into a more regular arrangement. Furthermore, the weighting allows data points at different distances from the current value to have different effects. The specific formula is as follows:
[0127] Where a, b, and c correspond to weighting coefficients at different positions, and a > b > c. The values of the weighting coefficients are set according to the actual scenario.
[0128] Additionally, in some embodiments, it is necessary to determine the lower limit value of the sampling points for sampling the signal under test before step 100. Specifically, during the first run of the system, since the exact signal frequency f of the measured object is unknown... x Therefore, it is necessary to satisfy the sampling frequency f. s and the lower frequency limit f of the signal under test low The calculated lower limit value M of the sampling points can usually be understood as the sampling points within n cycles above the lowest sampling frequency. The lower limit value M of the sampling points is: Where n is the desired number of sampling periods, f s The sampling frequency is set to 6400Hz. low This is the lower limit of the frequency. The number of sampling points M1 in step 300 must be greater than the lower limit value M of that sampling point to ensure that steps 400 and 500 can be implemented, thus providing a good prerequisite for judging the target peak and target valley values.
[0129] Device Examples
[0130] Please refer to Figure 4 On the other hand, embodiments of the present invention also provide a device for determining the peak and valley values of a signal, comprising:
[0131] The signal frequency acquisition module 401 is used to acquire the signal frequency of the signal to be measured.
[0132] The sampling point determination module 402 is used to determine multiple sampling points within a single period of the signal under test based on the signal frequency and a preset sampling frequency.
[0133] The first peak-valley value determination module 403 is used to fit a polynomial function based on the multiple sampling points, and to determine a first candidate peak value and a first candidate valley value based on the polynomial function.
[0134] The second peak-valley value determination module 404 is used to perform differential solution of discrete sampling points based on the multiple sampling points to determine the second candidate peak value and the second candidate valley value.
[0135] The target peak and valley value determination module 405 is used to determine the maximum value among the first candidate peak value and the second candidate peak value as the target peak value of the signal to be tested, and to determine the maximum value among the first candidate valley value and the second candidate valley value as the target valley value of the signal to be tested.
[0136] Optionally, the step of fitting a polynomial function based on the plurality of sampling points, and determining the first candidate peak and the first candidate valley based on the polynomial function, includes:
[0137] The multiple sampling points are fitted using a Taylor regression function to form a polynomial function;
[0138] The first candidate peak value and the first candidate valley value are determined based on the second derivative of the polynomial function.
[0139] Optionally, the fitting of the multiple sampling points based on the Taylor regression function to form a polynomial function includes:
[0140] The Taylor regression function is used to approximate the sign equation of multiple sampling points;
[0141] Based on the low-order polynomials of the symbolic equation, feature discrimination is performed to obtain the functional features of the symbolic equation;
[0142] A polynomial function is formed based on the aforementioned functional characteristics.
[0143] Optionally, the step of performing differential calculations on the discrete sampling points based on the plurality of sampling points to determine the second candidate peak value and the second candidate valley value includes:
[0144] A sampling vector is formed by concatenating multiple sampling points;
[0145] A first-order difference vector is calculated based on the sampling vector;
[0146] A trend vector is obtained by performing a sign function operation based on the first-order difference vector;
[0147] Iterate through the trend vectors and reassign values;
[0148] A first-order difference operation is performed on the reassigned trend vector to obtain the difference vector;
[0149] The second candidate peak and the second candidate valley are determined based on the difference vector.
[0150] Optionally, the peak and valley determination device for the signal further includes:
[0151] The verification module is used to compare each adjacent value within a set neighborhood of the target peak with the target peak, and to compare each adjacent value within a set neighborhood of the target valley with the target valley, so as to verify the accuracy of the target peak and the target valley.
[0152] Optionally, the peak and valley determination device for the signal further includes:
[0153] The smoothing and denoising module is used to perform smoothing and denoising processing on the signal under test based on the weighted moving average filtering method.
[0154] The signal peak and valley value determination device includes a processor and a memory. The signal frequency acquisition module 401, sampling point determination module 402, first peak and valley value determination module 403, second peak and valley value determination module 404, and target peak and valley value determination module 405 are all stored as program units in the memory. The processor executes the program units stored in the memory to realize the corresponding functions.
[0155] A processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured.
[0156] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0157] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call logic instructions in the memory 530 to execute a method for determining the peak and valley values of a signal. This method includes: acquiring the signal frequency of the signal to be tested; determining multiple sampling points within a single period of the signal to be tested based on the signal frequency and a preset sampling frequency; fitting a polynomial function based on the multiple sampling points to form a polynomial function, and determining a first candidate peak value and a first candidate valley value based on the polynomial function; performing a differential solution on the discrete sampling points based on the multiple sampling points to determine a second candidate peak value and a second candidate valley value; determining the maximum or minimum value among the first candidate peak value and the second candidate peak value as the target peak value of the signal to be tested, and determining the maximum or minimum value among the first candidate valley value and the second candidate valley value as the target valley value of the signal to be tested.
[0158] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0159] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program that can be stored on a machine-readable storage medium. When the computer program is executed by a processor, the computer is able to execute a method for determining the peak and valley values of a signal. The method includes: acquiring the signal frequency of a signal to be tested; determining multiple sampling points within a single period of the signal to be tested based on the signal frequency and a preset sampling frequency; fitting a polynomial function based on the multiple sampling points to form a polynomial function, and determining a first candidate peak value and a first candidate valley value based on the polynomial function; performing a differential solution on the discrete sampling points based on the multiple sampling points to determine a second candidate peak value and a second candidate valley value; determining the maximum or minimum value among the first candidate peak value and the second candidate peak value as the target peak value of the signal to be tested, and determining the maximum or minimum value among the first candidate valley value and the second candidate valley value as the target valley value of the signal to be tested.
[0160] In another aspect, the present invention also provides a machine-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a method for determining the peak and valley values of a signal. The method includes: acquiring the signal frequency of a signal to be measured; determining multiple sampling points within a single period of the signal to be measured based on the signal frequency and a preset sampling frequency; fitting a polynomial function based on the multiple sampling points; determining a first candidate peak value and a first candidate valley value based on the polynomial function; performing a differential solution on the discrete sampling points based on the multiple sampling points to determine a second candidate peak value and a second candidate valley value; determining the maximum or minimum value among the first and second candidate peak values as the target peak value of the signal to be measured; and determining the maximum or minimum value among the first and second candidate valley values as the target valley value of the signal to be measured.
[0161] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0162] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0163] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method of determining a peak and a valley of a signal, characterized by, The method comprises the following steps: acquiring a signal frequency of a to-be-tested signal; determining a plurality of sampling points in a single period of the to-be-tested signal based on the signal frequency and a preset sampling frequency; fitting a polynomial function based on the plurality of sampling points, and determining a first candidate peak value and a first candidate valley value based on the polynomial function; performing differential solving on discrete sampling points based on the plurality of sampling points to determine a second candidate peak value and a second candidate valley value; determining a maximum value between the first candidate peak value and the second candidate peak value as a target peak value of the to-be-tested signal, and determining a maximum value between the first candidate valley value and the second candidate valley value as a target valley value of the to-be-tested signal; the step of performing differential solving on discrete sampling points based on the plurality of sampling points to determine a second candidate peak value and a second candidate valley value comprises the following steps: splicing a sampling vector based on the plurality of sampling points; calculating a first-order difference vector based on the sampling vector; performing a sign function operation based on the first-order difference vector to obtain a trend vector; reassigning the trend vector; performing a first-order difference operation based on the re-assigned trend vector to obtain a difference vector; determining a second candidate peak value and a second candidate valley value based on the difference vector.
2. The peak and valley determination method of a signal according to claim 1, characterized by, the step of fitting a polynomial function based on the plurality of sampling points, and determining a first candidate peak value and a first candidate valley value based on the polynomial function comprises the following steps: fitting a polynomial function based on Taylor regression function fitting of the plurality of sampling points; performing second-order derivation based on the polynomial function, and determining a first candidate peak value and a first candidate valley value based on the result of the second-order derivation.
3. The peak and valley determination method of a signal according to claim 2, characterized by, the step of fitting a polynomial function based on Taylor regression function fitting of the plurality of sampling points comprises the following steps: approximating a sign equation of the plurality of sampling points by using Taylor regression function; performing feature discrimination based on a low-order polynomial of the sign equation to obtain a function feature of the sign equation; forming a polynomial function based on the function feature.
4. The method of peak and valley determination of a signal according to claim 1, wherein, after the step of determining a maximum value between the first candidate peak value and the second candidate peak value as a target peak value of the to-be-tested signal, and determining a maximum value between the first candidate valley value and the second candidate valley value as a target valley value of the to-be-tested signal, the method further comprises the following steps: comparing each adjacent value within a set neighborhood range of the target peak value with the target peak value, and comparing each adjacent value within a set neighborhood range of the target valley value with the target valley value, to verify the accuracy of the target peak value and the target valley value.
5. The method of peak and valley determination of a signal according to claim 1, wherein, before the step of acquiring a signal frequency of a to-be-tested signal, the method further comprises the following step: performing smooth denoising processing on the to-be-tested signal based on a weighted moving average filtering method.
6. An apparatus for determining a peak value and a valley value of a signal, characterized by comprising: The method comprises the following steps: a signal frequency acquisition module is configured to acquire a signal frequency of a to-be-tested signal; a sampling point determination module is configured to determine a plurality of sampling points in a single period of the to-be-tested signal based on the signal frequency and a preset sampling frequency; a first peak-valley value determination module is configured to fit a polynomial function based on the plurality of sampling points, and determine a first candidate peak value and a first candidate valley value based on the polynomial function; A second peak-valley value determination module is configured to determine a second candidate peak value and a second candidate valley value based on difference solving of discrete sampling points according to the plurality of sampling points; A target peak-valley value determination module is configured to determine a maximum value in the first candidate peak value and the second candidate peak value as a target peak value of the to-be-detected signal, and determine a minimum value in the first candidate valley value and the second candidate valley value as a target valley value of the to-be-detected signal; The determination of the second candidate peak value and the second candidate valley value based on the difference solving of the discrete sampling points according to the plurality of sampling points comprises the following steps: A sampling vector is formed based on the plurality of sampling points; A first-order difference vector is calculated based on the sampling vector; A trend vector is obtained by performing a sign function operation based on the first-order difference vector; The trend vector is traversed to perform reassignment; A difference vector is obtained by performing a first-order difference operation based on the re-assigned trend vector; The second candidate peak value and the second candidate valley value are determined based on the difference vector.
7. The peak and trough determination apparatus of claim 6, wherein, The fitting of the polynomial function based on the plurality of sampling points, and the determination of the first candidate peak value and the first candidate valley value based on the polynomial function, comprise the following steps: The plurality of sampling points are fitted based on a Taylor regression function to form a polynomial function; The first candidate peak value and the first candidate valley value are determined based on a result of twice derivation based on the polynomial function.
8. The peak and trough determination apparatus of claim 7, wherein, The fitting of the polynomial function based on the plurality of sampling points, and the determination of the first candidate peak value and the first candidate valley value based on the polynomial function, comprise the following steps: A sign equation of the plurality of sampling points is fitted by using a Taylor regression function; Function characteristics of the sign equation are obtained by performing feature discrimination based on a low-order polynomial of the sign equation; The polynomial function is formed based on the function characteristics.
9. The peak and valley determination apparatus of claim 6, wherein, The peak value and valley value determination apparatus of the signal further comprises: A verification module is configured to compare each adjacent value in a set neighborhood range of the target peak value with the target peak value, and compare each adjacent value in a set neighborhood range of the target valley value with the target valley value, to verify the accuracy of the target peak value and the target valley value.
10. The peak and valley determination apparatus of claim 6, wherein, The peak value and valley value determination apparatus of the signal further comprises: A smoothing and denoising module is configured to perform smoothing and denoising processing on the to-be-detected signal based on a weighted moving average filtering method.
11. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the peak value and valley value determination method of the signal according to any one of claims 1 to 5.
12. A machine-readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the peak value and valley value determination method of the signal according to any one of claims 1 to 5.
Citation Information
Patent Citations
Rapid fixed-point frequency deviation measurement method
CN110187174B
Method for compensation fitting differential signal used for extracting peak value of dispersion confocal
CN109186458A
Signal identification method for single-coil magnetic induction type abrasive particle detection sensor
CN109839334A