Peak-valley value detection method and system, electronic device and storage medium
By using dynamic evaluation of window length and local saliency evaluation, the shortcomings of existing peak-valley detection methods in terms of accuracy and efficiency are addressed, achieving adaptive peak-valley detection and improving detection accuracy and efficiency.
Patent Information
- Application Number
- CN202511280723.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-09
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2045-09-09
AI Technical Summary
Existing peak-valley detection methods are insufficient in terms of accuracy and efficiency, especially in terms of noise resistance and parameter settings, making them difficult to adapt to different signal scenarios.
By traversing and comparing the amplitude of candidate data points with the data points within the length of the windows on the left and right, the evaluation weight value of the window length is dynamically evaluated, the optimal window length is automatically selected, and the local significance of the target data points is evaluated based on the optimal window length, thus achieving adaptive detection of peak and valley values.
It significantly improves the accuracy and efficiency of peak and valley detection, has strong adaptability in different signal scenarios, accurately captures weak peak values and suppresses false peak interference, and maintains low computational complexity to meet real-time processing requirements.
Smart Images

Figure CN120761691B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of signal processing, and in particular to a peak-valley value detection method and system, an electronic device and a storage medium. BACKGROUND
[0002] In electronic measurement testing, real-time measured signals are complex and changeable, and contain rich information. The peak value is the maximum amplitude of the signal within a certain time period, reflecting the extreme strength or upper limit of energy of the signal. The valley value is the minimum amplitude of the signal within a certain time period, reflecting the minimum strength or lower limit of energy of the signal. Both of them together describe the fluctuation range and stability of the signal, and are commonly used to evaluate the impact of the signal on the equipment or analyze the characteristics of the signal. Therefore, finding the peak value and valley value of the real-time measured signal plays an important role in analyzing the quality of the test, and also has a great influence on the research and development efficiency and quality of electronic products.
[0003] The existing peak-valley value detection methods include derivative method, simple comparison method, linear fitting method and constant false alarm rate method. Among them, the derivative method is to smooth the signal, calculate the multi-order derivative of the signal waveform, then take the average value of the data, set a threshold according to the average value, and then screen the peak-valley value; the simple comparison method is to smooth the signal, then compare the maximum value to obtain the result; the linear fitting method is to calculate the linear function coefficient by least square method, then obtain the fitting curve according to the fitting function, and finally calculate the corresponding peak-valley value and the corresponding index; the constant false alarm rate method is to first set left and right window functions, then smooth the signal with the window, then take the average value of the optimized curve, set a threshold according to the average value, and finally screen the peak-valley value.
[0004] However, the derivative method and the simple comparison method have poor noise resistance, and in actual test scenarios, many false peak-valley values are detected, or real peak-valley values are missed, and the accuracy is not high. The linear fitting method and the constant false alarm rate method need to set too many parameters, and different parameters need to be set for different scenes, which is not efficient. SUMMARY
[0005] The present application provides a peak-valley value detection method, system, electronic device and storage medium to solve the problem of low accuracy and efficiency of the prior art for peak-valley value detection.
[0006] In a first aspect, the present application provides a peak-valley value detection method, comprising:
[0007] determining a first target evaluation weight value of the window length by iteratively comparing the amplitude of each candidate data point with the amplitudes of the data points within the window length on both sides of the candidate data point, until the window length reaches a preset length, and selecting the best window length from the window lengths based on the first target evaluation weight values of the window lengths;
[0008] gradually increasing the window length, iteratively performing the step of determining the first target evaluation weight value of the window length by iteratively comparing the amplitude of each candidate data point with the amplitudes of the data points within the window length on both sides of the candidate data point, until the window length reaches a preset length, and selecting the best window length from the window lengths based on the first target evaluation weight values of the window lengths;
[0009] determining a second target evaluation weight value of each target data point by iteratively comparing the amplitude of each target data point with the amplitudes of the data points within the best window length on both sides of the target data point; the target data point is determined based on the best window length and the array length; the second target evaluation weight value is used to reflect the local prominence of the target data point as a peak or a valley;
[0010] determining the peak or the valley in the real-time measured signal from the target data points based on the second target evaluation weight values of the target data points.
[0011] In one embodiment, the step of determining the first target evaluation weight value of the window length by iteratively comparing the amplitude of each candidate data point with the amplitudes of the data points within the window length on both sides of the candidate data point, when detecting a peak, comprises:
[0012] iteratively comparing the amplitude of each candidate data point with the amplitudes of the data points within the window length on both sides of the candidate data point;
[0013] In the process of iterating through all candidate data points, if the amplitude of the current candidate data point is greater than the amplitudes of the data points within the window length on both sides of the candidate data point, the first initial evaluation weight value of the window length is decreased until the first target evaluation weight value of the window length is obtained after the iteration is completed.
[0014] In one embodiment, the step of selecting the best window length from the window lengths based on the first target evaluation weight values of the window lengths comprises:
[0015] determining the window length corresponding to the minimum first target evaluation weight value in the first target evaluation weight values of the window lengths as the best window length.
[0016] In one embodiment, the second target evaluation weight value of each target data point is used to determine a peak or a valley in the real-time measured signal from each target data point, including:
[0017] The second target evaluation weight value of each target data point is used to determine a plurality of peaks from each target data point.
[0018] If the difference between the index values of two adjacent peaks is less than a preset value, the two adjacent peaks are combined into one peak, and a plurality of peaks in the real-time measured signal are obtained.
[0019] In one embodiment, after determining the peaks in the real-time measured signal, further comprising:
[0020] Jump to the highest peak and mark the corresponding peak feature information;
[0021] According to the target sorting result, jump from the highest peak to each peak detected in real time in turn, and mark the corresponding peak feature information at each time of jumping to a peak; the target sorting result is updated based on the plurality of peaks detected in real time at each time of jumping; the target sorting result is obtained by sorting the peaks with equal amplitudes in ascending order according to the size of the index values corresponding to the peaks with equal amplitudes under the condition that there are at least two peaks with equal amplitudes in the initial sorting result; the initial sorting result is obtained by sorting the peaks in descending order based on the size of the amplitudes corresponding to the peaks.
[0022] In one embodiment, after determining the peaks in the real-time measured signal, further comprising:
[0023] Jump from the highest peak to the rightmost peak in the plurality of peaks detected in real time, and mark the corresponding peak feature information;
[0024] According to the order of the index values of the peaks, jump from the rightmost peak to each peak detected in real time in turn, and mark the corresponding peak feature information at each time of jumping to a peak, until stopping at the leftmost peak in the plurality of peaks detected in real time.
[0025] In one embodiment, after determining the peaks in the real-time measured signal, further comprising:
[0026] Jump from the highest peak to the leftmost peak in the plurality of peaks detected in real time, and mark the corresponding peak feature information;
[0027] According to the order of the index values of the peaks, jump from the leftmost peak to each peak detected in real time in turn, and mark the corresponding peak feature information at each time of jumping to a peak, until stopping at the rightmost peak in the plurality of peaks detected in real time.
[0028] In a second aspect, the present application provides a peak-valley value detection system, comprising:
[0029] The first determining module is configured to compare the amplitude of each candidate data point with the amplitudes of the data points within the window length on the left and right sides of the candidate data point, and determine a first target evaluation weight value of the window length; the candidate data point is determined based on the window length and the array length; the array is composed of the amplitudes corresponding to the plurality of data points in the real-time measured signal; and the first target evaluation weight value is used to reflect the effectiveness of detecting the peak value or the valley value under the condition of the window length.
[0030] The window selecting module is configured to gradually increase the window length, iteratively perform the step of comparing the amplitude of each candidate data point with the amplitudes of the data points within the window length on the left and right sides of the candidate data point, and determine a first target evaluation weight value of the window length, until the window length reaches a preset length, and select a best window length from the window lengths based on the first target evaluation weight values of the window lengths.
[0031] The second determining module is configured to compare the amplitude of each target data point with the amplitudes of the data points within the best window length on the left and right sides of the target data point, and determine a second target evaluation weight value of each target data point; the target data point is determined based on the best window length and the array length; and the second target evaluation weight value is used to reflect the local prominence of the target data point as the peak value or the valley value.
[0032] The peak-valley value detection module is configured to determine the peak value or the valley value in the real-time measured signal from the target data points based on the second target evaluation weight values of the target data points.
[0033] In a third aspect, the present application provides an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the peak-valley value detection method according to any one of the above aspects when executing the program.
[0034] In a fourth aspect, the present application provides a non-transitory computer readable storage medium, which stores a computer program, and the computer program implements the steps of the peak-valley value detection method according to any one of the above aspects when executed by a processor.
[0035] The peak-valley value detection method, system, electronic device and storage medium provided by the application first cycle through the increment window length and calculate the first target evaluation weight value, dynamically evaluate the effectiveness of different window lengths on peak-valley value detection, automatically filter out the best window length that adapts to the current signal characteristics, without relying on manual parameter setting, significantly improving the universality in different signal scenarios; the second cycle is based on the best window length to compare the amplitude of the left and right neighborhood of the target data point, and quantifies its local significance as a peak-valley value through the second target evaluation weight value, which can accurately capture weak peaks and effectively suppress false peak interference; the synergy of the two cycle scores makes the peak-valley window self-adaptive performance extremely high, while maintaining low computational complexity to meet real-time processing requirements, and improves the accuracy and efficiency of peak-valley value detection as a whole. BRIEF DESCRIPTION OF DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0037] Figure 1 is one of the flowcharts of the peak-valley value detection method provided by the application.
[0038] Figure 2 is the second flowchart of the peak-valley value detection method provided by the application.
[0039] Figure 3 is the logic diagram of peak value jump provided by the application.
[0040] Figure 4 is the logic diagram of valley value jump provided by the application.
[0041] Figure 5 is the peak value detection effect diagram of the general signal provided by the application.
[0042] Figure 6 is the valley value detection effect diagram of the general signal provided by the application.
[0043] Figure 7 is the peak value detection effect diagram of the square wave signal provided by the application.
[0044] Figure 8 is the structure diagram of the peak-valley value detection system provided by the application.
[0045] Figure 9 is the structure diagram of the electronic device provided by the application. DETAILED DESCRIPTION
[0046] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below in conjunction with the drawings in the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work belong to the protection scope of the present application.
[0047] The terms "first", "second" and the like in the present application are used to distinguish similar objects, and are not used to describe a particular order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein.
[0048] The peak-valley value detection method, system, electronic device and storage medium provided by the present application will be described below. Figures 1-9 The peak-valley value detection method, system, electronic device and storage medium provided by the present application will be described below.
[0049] The peak-valley value detection method provided by the embodiments of the present application is realized based on the peak-valley value detection system, therefore, the embodiments of the present application take the peak-valley value detection system as the execution subject, and specifically describe the peak-valley value detection method.
[0050] The peak-valley value detection method provided by the embodiments of the present application is realized based on the peak-valley value detection system, therefore, the embodiments of the present application take the peak-valley value detection system as the execution subject, and specifically describe the peak-valley value detection method. Figure 1 And Figure 2 , Figure 1 is one of the flowcharts of the peak-valley value detection method provided by the present application, Figure 2 is another flowchart of the peak-valley value detection method provided by the present application.
[0051] As Figure 1 shown, the peak-valley value detection method comprises the following steps:
[0052] Step 101, comparing the amplitude of each candidate data point with the amplitude of the data points within the window length on the left and right sides of the candidate data point, to determine the first target evaluation weight value of the window length;
[0053] Step 102, increasing the window length step by step, and iteratively performing the step of comparing the amplitude of each candidate data point with the amplitude of the data points within the window length on the left and right sides of the candidate data point, to determine the first target evaluation weight value of the window length, until the window length reaches a preset length, and selecting the best window length from the window lengths based on the first target evaluation weight value of each window length;
[0054] Step 103, comparing the amplitude of each target data point with the amplitude of the data points within the best window length on the left and right sides of the target data point, to determine the second target evaluation weight value of each target data point;
[0055] Step 104, determining the peak or valley in the real-time measured signal from each target data point based on the second target evaluation weight value of each target data point.
[0056] Specifically, the measured signal refers to the original physical quantity or electrical signal that needs to be collected, analyzed or recorded in the measurement, monitoring or experiment process. The real-time measured signal often contains transient changes such as burst pulses, short peaks, transient fluctuations, etc. These characteristics may only last for a very short time, and if non-real-time collection or offline recording and analysis are used, key peak and valley values may be lost due to too large sampling interval or data transmission delay. Peak and valley detection of real-time measured signal can ensure the capture of transient characteristics of the signal and guarantee the authenticity of the data.
[0057] The real-time measured signal is converted into an analog electrical signal by a sensor, and then discretely sampled at a fixed sampling frequency by an analog-to-digital converter to obtain a series of data points arranged in time sequence, forming an array. Each element (data point) in the array corresponds to the signal amplitude at a specific time, and the array length N is determined by the sampling time length and the sampling frequency.
[0058] The real-time measured signal is processed in two cycles in this embodiment. In the first cycle, the optimal window length is calculated, and in the second cycle, the peak or valley is detected based on the optimal window length determined in the first cycle.
[0059] In the first cycle, the window length k is initialized, and the first initial evaluation weight value w1 of the window length k is determined.
[0060] The candidate data point range is determined based on the window length and the array length. The candidate data point needs to satisfy that there are at least k valid data points on both sides, i.e. excluding the array edge data points to ensure the integrity of the subsequent neighborhood comparison.
[0061] Optionally, the array length is N, the window length is k, and the selected candidate data points are the data points in the range of (k+1) to (N-k). The cycle range of the candidate data points for subsequent neighborhood comparison is from (k+1) to (N-k). In addition, multiple consecutive data points in the range of (k+1) to (N-k) can also be selected as candidate data points. The specific way of selecting candidate data points can be set according to the actual situation. This embodiment takes all data points in the range of (k+1) to (N-k) as candidate data points as an example to describe the subsequent process.
[0062] The comparison of the amplitude of each candidate data point with the amplitudes of the data points within the window length k on the left and right sides of the candidate data point can be understood as follows: for each candidate data point, the amplitude of the candidate data point is compared with the amplitudes of the k data points on the left and right sides of the candidate data point. If the comparison result satisfies the peak value condition (i.e., the amplitude of the candidate data point is greater than the amplitudes of all k data points on the left and right sides), the first initial evaluation weight value w1 of the window length k is reduced. The loop range of this process is from the (k+1)th data point to the (N-k)th data point. The accumulated first initial evaluation weight value after the loop process is completed is called the first target evaluation weight value, which is used to reflect the effectiveness of detecting the peak value under the condition of the window length k.
[0063] The comparison of the amplitude of each candidate data point with the amplitudes of the data points within the window length k on the left and right sides of the candidate data point can also be understood as follows: for each candidate data point, the amplitude of the candidate data point is compared with the amplitudes of the k data points on the left and right sides of the candidate data point. If the comparison result satisfies the valley value condition (i.e., the amplitude of the candidate data point is less than the amplitudes of all k data points on the left and right sides), the first initial evaluation weight value w1 of the window length k is reduced. The loop range of this process is from the (k+1)th data point to the (N-k)th data point. The accumulated first initial evaluation weight value after the loop process is completed is called the first target evaluation weight value W1, which is also used to reflect the effectiveness of detecting the valley value under the condition of the window length k.
[0064] The window length is increased by 1 step by step, and the above loop process is repeated for each window length until the window length reaches the preset length, and the first target evaluation weight value W1 corresponding to different window lengths can be obtained. The preset length is set according to the actual situation. Optionally, if the array length N is odd, the preset length is N / 2; if the array length N is even, the preset length is (N / 2)-1. Of course, the preset length can also be set to a smaller value.
[0065] Based on the comparison of the sizes of the first target evaluation weight values of the window lengths, the best window length L is selected from the window lengths.
[0066] The range of target data points is re-determined based on the best window length L. The edge data points of the array are excluded, and each target data point has a complete left and right neighborhood, which can be compared in the subsequent neighborhood comparison.
[0067] In the second loop process, the second initial evaluation weight value w2 of the target data point is initialized.
[0068] Optionally, the array length is N, the optimal window length is L, the selected target data points are data points in the range of (L+1) to (N-L), and the loop range for subsequent neighborhood comparison of the target data points is from (L+1) to (N-L). In addition, a plurality of continuous data points in the range of (L+1) to (N-L) can also be selected as target data points. The specific selection of target data points can be set according to actual conditions. The embodiment takes all data points in the range of (L+1) to (N-L) as target data points as an example to describe the subsequent process.
[0069] The amplitude of each target data point and the data points within the optimal window length L on the left and right sides are compared. It can be understood that for each target data point, the amplitude of the target data point is compared with the amplitudes of the L data points on the left and the L data points on the right. If the comparison result satisfies the peak condition (i.e., the amplitude of the target data point is greater than the amplitudes of all L data points on the left and right sides), the second initial evaluation weight value w2 of the optimal window length L is increased. The loop range of this process is from the (L+1)th data point to the (N-L)th data point. After the loop process is completed, the accumulated second initial evaluation weight value is called the second target evaluation weight value W2, which is used to reflect the local prominence of the target data point as a peak value.
[0070] The amplitude of each target data point and the data points within the optimal window length L on the left and right sides are compared. It can be understood that for each target data point, the amplitude of the target data point is compared with the amplitudes of the L data points on the left and the L data points on the right. If the comparison result satisfies the valley condition (i.e., the amplitude of the target data point is less than the amplitudes of all L data points on the left and right sides), the second initial evaluation weight value w2 of the optimal window length L is increased. The loop range of this process is from the (L+1)th data point to the (N-L)th data point. After the loop process is completed, the accumulated second initial evaluation weight value is called the second target evaluation weight value W2, which is used to reflect the local prominence of the target data point as a valley value.
[0071] After the above loop traversal process is completed, the second target evaluation weight value W2 of each target data point is obtained. Based on the size comparison of the second target evaluation weight values of the target data points, the peak value or the valley value in the real-time measured signal is determined from the target data points.
[0072] The peak-valley value detection method provided by the application first passes through a first cycle to traverse an incremental window length and calculate a first target evaluation weight value, dynamically evaluates the effectiveness of different window lengths on peak-valley value detection, automatically filters out the best window length that adapts to the current signal characteristics, does not need to rely on manual parameter setting, and significantly improves the universality in different signal scenarios; a second cycle is based on the best window length to compare the amplitude of the left and right neighborhoods of the target data point, quantifies the local significance of the peak-valley value through a second target evaluation weight value, can accurately capture weak peaks, and can effectively suppress false peak interference; the synergy of the scores of the two cycles makes the window self-adaptive performance extremely high when searching for peaks and valleys, while maintaining a low computational complexity to meet real-time processing requirements, and overall improves the accuracy and efficiency of peak-valley value detection.
[0073] In some embodiments, the traversal compares the amplitude of each candidate data point with the amplitudes of the data points within the window length on the left and right sides of the candidate data point, determines a first target evaluation weight value of the window length, and when detecting a peak value, includes:
[0074] The amplitude of each candidate data point is compared with the amplitudes of the data points within the window length on the left and right sides of the candidate data point.
[0075] During the traversal of all candidate data points, if the amplitude of the current candidate data point is greater than the amplitudes of the data points within the window length on the left and right sides of the candidate data point, the first initial evaluation weight value of the window length is reduced until the first target evaluation weight value of the window length is obtained after the traversal is completed.
[0076] Specifically, during the first round of circulation, the window length k is first initialized, and the first initial evaluation weight value w1 of the window length k is initialized.
[0077] The amplitude of each candidate data point is compared with the amplitudes of the data points within the window length k on the left and right sides of the candidate data point.
[0078] During the traversal and comparison, if the amplitude of the currently traversed candidate data point is greater than the amplitudes of the k data points on the left side and greater than the amplitudes of the k data points on the right side, the first initial evaluation weight value w1 of the current window length k is reduced; if the amplitude of the currently traversed candidate data point is less than or equal to the amplitude of any one of the k data points on the left and right sides, the first initial evaluation weight value w1 of the current window length k is not adjusted.
[0079] Optionally, the first initial evaluation weight value of the window length k is reduced, that is, the first initial evaluation weight value minus a preset adjustment value. Assuming that the preset adjustment value is 1, when the comparison result meets the peak value condition, wherein, is the first initial evaluation weight value adjusted according to the comparison result, is the first initial evaluation weight value adjusted in the last round of comparison.
[0080] Through the above-mentioned way, the amplitude is compared and the first initial evaluation weight value is adjusted until all the candidate data points are traversed, and the first initial evaluation weight value of each round is accumulated, so that the first target evaluation weight value W1 of the window length k is obtained.
[0081] From the above, it can be deduced that the first target evaluation weight value of the window length is determined by comparing the amplitude of each candidate data point with the amplitudes of the data points in the window length on the left and right sides, and when detecting the valley value, it includes:
[0082] The amplitudes of each candidate data point and the data points in the window length on the left and right sides are compared.
[0083] In the process of traversing all candidate data points, if the amplitude of the current candidate data point is smaller than the amplitudes of the data points in the window length on the left and right sides, the first initial evaluation weight value of the window length is reduced until the first target evaluation weight value of the window length is obtained after the traversal is completed.
[0084] In the first round of circulation, the traversal comparison process for the valley value and the traversal comparison process for the peak value are consistent, except that the amplitude of the candidate data point to be compared needs to meet the amplitude of all data points in the comparison range, and the detailed process is the same as the above-mentioned traversal comparison process of the peak value, which is not repeated here.
[0085] The evaluation weight value of the window length is dynamically adjusted, the applicability of the window length is quantified, the detection sensitivity and the anti-interference ability are effectively balanced, so that the adaptive detection of the peak and valley values in the real-time measured signal is realized, and the accuracy and robustness of the peak and valley value detection are improved.
[0086] In some embodiments, based on step 103, the first target evaluation weight value based on each window length is used to select the best window length from each window length, including:
[0087] The window length corresponding to the minimum first target evaluation weight value in the first target evaluation weight value of each window length is determined as the best window length.
[0088] Specifically, the first target evaluation weights of each window length are compared in value, and the minimum first target evaluation weight value is determined according to the comparison result.
[0089] The window length corresponding to the minimum first target evaluation weight value is determined as the best window length.
[0090] The embodiment of the present application quantifies the adaptability of different windows to peak-valley value detection through a scoring weight mechanism, so as to find the best window length that has more data points meeting the peak-valley value condition and better adaptability, thereby realizing automatic optimization of the window length, avoiding subjectivity of manual parameter adjustment, and further improving the automation level and result reliability of the peak-valley value detection algorithm.
[0091] In some embodiments, based on step 104, the amplitude values of each target data point and the data points within the best window length on the left and right sides of the target data point are compared, and a second target evaluation weight value of each target data point is determined, including:
[0092] The amplitude values of each target data point and the data points within the best window length on the left and right sides of the target data point are compared.
[0093] In the process of traversing all target data points, if the amplitude value of the current target data point is greater than the amplitude values of the data points within the best window length on the left and right sides of the target data point, the second initial evaluation weight value of the current target data point is increased until the second target evaluation weight value of each target data point is obtained after the traversal is completed.
[0094] Specifically, on the basis of the best window length L, the range of target data points is selected, and the amplitude values of these target data points are compared.
[0095] In the second round of iteration, the second initial evaluation weight value w2 of the target data point is initialized.
[0096] The amplitude values of each target data point and the data points within the best window length L on the left and right sides of the target data point are compared.
[0097] In the process of iterative comparison, if the amplitude value of the current target data point is greater than the amplitude values of the L data points on the left side and the L data points on the right side, the second initial evaluation weight value w2 of the current target data point is increased; if the amplitude value of the current target data point is less than or equal to the amplitude value of any one of the L data points on the left and right sides, the second initial evaluation weight value w2 of the current target data point is not adjusted.
[0098] Optionally, the second initial evaluation weight value of the target data point is increased, that is, the second initial evaluation weight value is increased by a preset adjustment value. Assuming that the preset adjustment value is 1, when the comparison result meets the peak value condition, wherein, is the second initial evaluation weight value adjusted according to the comparison result, is the initialized second initial evaluation weight value.
[0099] The amplitude of each target data point is compared with the amplitude of the data points in the optimal window length on the left and right sides of the target data point, and the second target evaluation weight value of each target data point is determined.
[0100] It can be deduced from the above that the amplitude of each target data point is compared with the amplitude of the data points in the optimal window length on the left and right sides of the target data point, and the second target evaluation weight value of each target data point is determined, including:
[0101] The amplitude of each target data point is compared with the amplitude of the data points in the optimal window length on the left and right sides of the target data point.
[0102] During the traversal of all target data points, if the amplitude of the current target data point is smaller than the amplitude of the data points in the optimal window length on the left and right sides of the target data point, the second initial evaluation weight value of the current target data point is increased until the second target evaluation weight value of each target data point is obtained after the traversal is completed.
[0103] During the second round of circulation, the traversal comparison process for the valley value and the traversal comparison process for the peak value are consistent, except that the amplitude of the candidate data point to be compared needs to satisfy the amplitude of all data points in the comparison range, and the detailed process is the same as the above-mentioned traversal comparison process for the peak value, which will not be repeated here.
[0104] In the embodiments of the present application, under the condition of the optimal window length, the evaluation weight value is dynamically adjusted by comparing the amplitude of the target data point with the amplitude of the data points in the left and right windows, the peak-valley value characteristics of each target data point are quantitatively evaluated, a reliable basis is provided for subsequent accurate detection of the peak-valley value in the real-time measured signal, and the accuracy of the peak-valley value detection is improved.
[0105] In some embodiments, based on step 104, the peak value or the valley value in the real-time measured signal is determined from the target data points based on the second target evaluation weight value of each target data point, including:
[0106] Based on the second target evaluation weight value of each target data point, a plurality of peak values are determined from the target data points.
[0107] If the difference between the index values of two adjacent peak values is less than a preset value, the two adjacent peak values are combined into one peak value, and a plurality of peak values in the real-time measured signal are obtained.
[0108] Specifically, the second target evaluation weight values of the target data points are compared, and a plurality of maximum second target evaluation weight values are determined according to the comparison results.
[0109] The target data points corresponding to the maximum second target evaluation weight values are determined as peak values, and the peak values are sorted in ascending order according to their index values.
[0110] If the difference between the index values of two adjacent peak values is less than a preset value, it means that the two adjacent peak values are close to each other, for example, the difference between the index values of two adjacent peak values is 1, then the two adjacent peak values are merged into one peak value, and finally a plurality of peak values in the real-time measured signal are obtained.
[0111] Similarly, if the difference between the index values of a plurality of continuous adjacent peak values is less than a preset value, it means that the plurality of continuous adjacent peak values are close to each other, then the plurality of continuous adjacent peak values are merged into one peak value, and finally a plurality of peak values in the real-time measured signal are obtained.
[0112] Optionally, the peak value merging can adopt an amplitude-based merging manner, that is, the peak value with a larger amplitude is retained, and the smaller peak value is removed. The peak value merging can also adopt a weighted average-based merging manner, that is, the position and amplitude of the peak value are merged according to the amplitude weight. The peak value merging can also adopt an index interval-based merging manner, that is, all points between two peak values or a plurality of peak values are directly merged into a new interval, and the data point corresponding to the maximum amplitude in the interval is taken as the merged peak value.
[0113] From the above, the second target evaluation weight value based on each target data point determines the peak value or the valley value in the real-time measured signal from each target data point, and when the valley value is determined, the second target evaluation weight value based on each target data point determines a plurality of valley values from each target data point.
[0114] The second target evaluation weight value based on each target data point determines a plurality of valley values from each target data point.
[0115] If the difference between the index values of two adjacent valley values is less than a preset value, the two adjacent valley values are merged into one valley value, and a plurality of valley values in the real-time measured signal are obtained.
[0116] The process of valley value detection is consistent with the process of peak value detection, as described above, and will not be repeated here.
[0117] The embodiment of the application screens potential peak and valley values by evaluation weight values, and merges adjacent peak values or valley values with an index difference less than a preset value, which can effectively solve the problem of dense redundant extreme value points easily generated in the flat-top region of a square wave, avoid misjudging the same flat-top segment as a plurality of peak values or valley values, realize accurate extraction and aggregation of real peak and valley values, greatly reduce the number of detected peak and valley value points, and ensure the reliability of the peak and valley value detection result.
[0118] Based on the above peak-valley value detection process, an actual example is listed for peak value detection. Assume that the array composed of the amplitude of each data point in the real-time measured signal is data=[2, 5, 3, 8, 7, 10, 9, 12, 6, 4], and the array length is 10.
[0119] Enter the first round of circulation to determine the optimal window length.
[0120] First, initialize the window length k=1, the first initial evaluation weight value w1 of the window length k=1 is 0, and determine the candidate data point range as the 2nd to 9th data points. Traverse and compare the amplitude of each candidate data point with the amplitude of 1 data point on its left and 1 data point on its right. When the comparison result meets the peak value condition, the first initial evaluation weight value w1 of the window length k=1 is reduced by 1. Accumulate the traversal result to obtain the first target evaluation weight value W1 of the window length k=1.
[0121] Increase the window length step by step, and iteratively execute the above circulation traversal process until the window length reaches k=4, i.e. the first target evaluation weight value of each window length can be obtained.
[0122] When the window length k=1, traverse the 2nd to 9th data points for amplitude comparison, the points with index 3, 5, 7, and 9 meet the peak value condition, a total of 4 data points, then the first target evaluation weight value W1 of the window length k=1 is -4;
[0123] When the window length k=2, traverse the 2nd to 9th data points for amplitude comparison, there is no point meeting the peak value condition, then the first target evaluation weight value W1 of the window length k=2 is 0;
[0124] When the window length k=3, traverse the 2nd to 9th data points for amplitude comparison, there is no point meeting the peak value condition, then the first target evaluation weight value W1 of the window length k=3 is 0;
[0125] When the window length k=4, traverse the 2nd to 9th data points for amplitude comparison, there is no point meeting the peak value condition, then the first target evaluation weight value W1 of the window length k=4 is 0;
[0126] Select the window length k with the minimum first target evaluation weight value, then the optimal window length is 1.
[0127] Enter the second round of circulation to detect the peak value in the real-time measured signal.
[0128] First, determine the target data point range as the 2nd to 9th data points, and initialize the second initial evaluation weight value w2 of the target data point as 0.
[0129] The amplitude of each target data point is compared with the amplitude of one data point on its left and one data point on its right, and when the comparison result meets the peak condition, the second initial evaluation weight value w2 of the target data point is added by 1 to obtain the second target evaluation weight value W2 of the target data point.
[0130] The target data point with an index value of 2: data(2)=5, is compared with data(1)=2 and data(3)=3 in amplitude size, and the comparison result is 5>2 and 5>3, which meets the peak condition, so the second target evaluation weight value W2 of the target data point with an index of 2 is W2=1;
[0131] The target data point with an index value of 3: data(3)=3, is compared with data(2)=5 and data(4)=8 in amplitude size, and the comparison result is 3<5 and 3<8, which does not meet the peak condition, so the second target evaluation weight value W2 of the target data point with an index of 3 is W2=0;
[0132] The target data point with an index value of 4: data(4)=8, is compared with data(3)=3 and data(5)=7 in amplitude size, and the comparison result is 8>3 and 8>7, which meets the peak condition, so the second target evaluation weight value W2 of the target data point with an index of 4 is W2=1;
[0133] The target data point with an index value of 5: data(5)=7, is compared with data(4)=8 and data(6)=10 in amplitude size, and the comparison result is 7<8 and 7<10, which does not meet the peak condition, so the second target evaluation weight value W2 of the target data point with an index of 5 is W2=0;
[0134] The target data point with an index value of 6: data(6)=10, is compared with data(5)=7 and data(7)=9 in amplitude size, and the comparison result is 10>7 and 10>9, which meets the peak condition, so the second target evaluation weight value W2 of the target data point with an index of 6 is W2=1;
[0135] The target data point with an index value of 7: data(7)=9, is compared with data(6)=10 and data(8)=12 in amplitude size, and the comparison result is 9<10 and 9<12, which does not meet the peak condition, so the second target evaluation weight value W2 of the target data point with an index of 7 is W2=0;
[0136] The target data point with an index value of 8: data(8)=12, is compared with data(7)=9 and data(9)=6 in amplitude size, and the comparison result is 12>9 and 12>6, which meets the peak condition, so the second target evaluation weight value W2 of the target data point with an index of 8 is W2=1;
[0137] The target data point with index value 9: data(9)=6, compared with data(8)=12 and data(10)=4 in amplitude size, the comparison result is 6<12 and 6>4, which does not meet the peak value condition, so the second target evaluation weight value W2 of the target data point with index 9 is 0;
[0138] The final peak value indexes are: 2, 4, 6, 8; and the corresponding peak values are: 5, 8, 10, 12. The difference between the indexes of adjacent peak values is not less than 2, so it is not necessary to combine the peak values. The multiple peak values in the real-time measured signal are finally: 5, 8, 10, 12.
[0139] Further, after the peak and valley value detection is completed, the peak and valley value feature information can be marked by a peak and valley value jump algorithm, that is, when jumping to a peak value or a valley value, the corresponding peak value feature information or valley value feature information is marked. The peak value feature information can include the amplitude size, frequency size and position information corresponding to the peak value, and the valley value feature information can include the amplitude size, frequency size and position information corresponding to the valley value.
[0140] The embodiment introduces three functions to realize the jump algorithm, that is, a Next Peak (next peak value) function, a Next Left Peak (next left peak value) function and a Next Right Peak (next right peak value) function. The Next Peak function provides that, when jumping for the first time, the highest peak value or the lowest valley value is jumped to by default, and then the peak values / valley values are jumped according to the order of the amplitude size and the index value thereof. The Next Left Peak function provides that the peak values / valley values are jumped from the peak value / valley value at the right boundary to the adjacent peak values / valley values on the left side, and the jumping is stopped when the peak value / valley value at the left boundary is jumped to. The Next Right Peak function provides that the peak values / valley values are jumped from the peak value / valley value at the left boundary to the adjacent peak values / valley values on the right side, and the jumping is stopped when the peak value / valley value at the right boundary is jumped to.
[0141] In combination with Figures 3-4 , Figure 3 is a logic diagram of peak value jumping provided by the embodiment, Figure 4 is a logic diagram of valley value jumping provided by the embodiment.
[0142] In some embodiments, after determining the peak values in the real-time measured signal, the method further comprises:
[0143] jumping to the highest peak value and marking the corresponding peak value feature information;
[0144] jump to each peak value in turn according to the target sorting result, and mark the peak feature information corresponding to each peak value at each time of jumping to the peak value; the target sorting result is updated based on the multiple peak values detected in real time at each time of jumping; the target sorting result is obtained by sorting the multiple peak values in ascending order according to the index values corresponding to the multiple peak values with equal amplitudes, on the condition that there are at least two peak values with equal amplitudes in the initial sorting result; the initial sorting result is obtained by sorting the multiple peak values in descending order according to the amplitudes corresponding to the multiple peak values.
[0145] Specifically, it is first determined whether the current is the highest peak value, and if not, the highest peak value is jumped to by default, and the peak feature information corresponding to the highest peak value is marked. Then, the Next Peak function is executed.
[0146] Before jumping, since the Next Peak function jumps according to the order of the amplitudes of the peak values and the index values, sorting is needed first. After determining the multiple peak values in the real-time measured signal, the multiple peak values are first sorted in descending order according to the amplitudes corresponding to the multiple peak values, to obtain an initial sorting result, and further, if there are at least two peak values with equal amplitudes in the initial sorting result, the multiple peak values with equal amplitudes are sorted in ascending order according to the index values corresponding to the multiple peak values with equal amplitudes, to finally obtain the target sorting result of all the peak values.
[0147] According to the target sorting result, jump to each peak value in turn from the highest peak value, and mark the peak feature information corresponding to each peak value at each time of jumping to the peak value, until the last peak value (i.e. the lowest peak value) in the target sorting result is jumped to and marked, and then stop.
[0148] It should be noted that in actual measurement, the measured signal will have random noise, which will change in real time. Since the algorithm for detecting the peak and valley values of the real-time measured signal is also real-time, the detected peak values are updated as the peak values detected in real time at each time of jumping. The target sorting result is updated based on the multiple peak values detected in real time at each time of jumping. If the second peak value in the order is jumped to and marked according to the target sorting result updated in real time at the current time, the third peak value in the order is jumped to and marked according to the target sorting result updated in real time at the next time, and so on, until the last peak value (i.e. the lowest peak value) in the target sorting result is jumped to and marked, and then stop.
[0149] Generally speaking, the measured signal changes in real time, but the fluctuation of the amplitude is not large, so the target sorting result updated based on the multiple peak values detected in real time at each time of jumping generally does not change.
[0150] From the above, it can be deduced that after determining the valley value in the real-time measured signal, it further comprises:
[0151] Jump to the lowest valley value and mark the corresponding valley value feature information;
[0152] According to the target sorting result, jump from the lowest valley value to each valley value detected in real time in turn, and mark the corresponding valley value feature information at each time of jumping to the valley value; the target sorting result is updated based on the plurality of valley values detected in real time at each time of jumping; the target sorting result is obtained by sorting the plurality of valley values in ascending order according to the index value corresponding to each valley value with equal amplitude in the initial sorting result; the initial sorting result is obtained by sorting the plurality of valley values in descending order according to the amplitude corresponding to each valley value.
[0153] The process of valley value jumping and marking is consistent with that of peak value jumping and marking, except that the valley values are sorted in descending order and the jumping process is also in descending order, and the specific process is as described above and will not be repeated here.
[0154] In the embodiments of the present application, the Next Peak function is used to jump and mark according to the sorting result. If the left and right adjacent physical positions are directly used for jumping (such as searching for the next peak value or valley value to the left / right of the current peak value or valley value), noise may cause the amplitude or position of the adjacent peak value or valley value to change frequently in real-time updating (for example, a new peak value appears on the left side at one time of jumping, and a higher peak value appears on the right side at the next time of jumping), thereby causing randomness of “jumping to the left but jumping to the right”. After determining the fixed jumping sequence by amplitude sorting combined with index assistance, the target of each jump is the peak value or valley value arranged in the order of “energy priority” (amplitude from high to low) or “frequency size order” (index in ascending order). Even if individual points fluctuate slightly due to noise, the overall jumping logic still follows the preset rules (such as always jumping from the highest peak value to the second highest, third highest, etc.), avoiding the confusion caused by local position changes and ensuring the stability and predictability of the jumping path.
[0155] In some embodiments, after determining the peak value in the real-time measured signal, it further comprises:
[0156] Jump from the highest peak value to the rightmost peak value in the plurality of peak values detected in real time, and mark the corresponding peak value feature information;
[0157] According to the order of the index value of each peak value, jump from the rightmost peak value to each peak value detected in real time in turn, and mark the corresponding peak value feature information at each time of jumping to the peak value, until stopping at the leftmost peak value in the plurality of peak values detected in real time.
[0158] Specifically, firstly, it is judged whether the current is at the highest peak value or not, if not, it is defaulted to jump to the highest peak value and mark the corresponding peak value characteristic information. Then, the Next Left Peak function is executed.
[0159] Jump from the highest peak value to the rightmost peak value in the multiple peak values detected in real time and mark the corresponding peak value characteristic information.
[0160] Further, according to the index value of each peak value from large to small, jump from the rightmost peak value to each peak value detected in real time in turn, and mark the corresponding peak value characteristic information each time the peak value is jumped to, until the leftmost peak value in the multiple peak values detected in real time is jumped to and marked, and then stop.
[0161] From the above, after determining the valley value in the real-time measured signal, further comprising:
[0162] Jump from the lowest valley value to the rightmost valley value in the multiple valley values detected in real time and mark the corresponding valley value characteristic information.
[0163] According to the order of the index value of each valley value, jump from the rightmost valley value to each valley value detected in real time in turn, and mark the corresponding valley value characteristic information each time the valley value is jumped to, until the leftmost valley value in the multiple valley values detected in real time is jumped to and stopped.
[0164] The valley value jumping and marking process is consistent with the peak value jumping and marking process, and the specific process is as described above, which will not be repeated here.
[0165] It should be noted that the implementation of the Next Left Peak function forces left jump. When the Next Left Peak function is used, it is judged whether the next peak value / valley value to be jumped to is on the left side or not, if it is on the right side due to noise influence, the jump function will be exited. In actual use, the signal-to-noise ratio of the measured signal is relatively high, and the jump direction confusion caused by noise is not necessarily, and through the Next Left Peak function, the jump direction confusion situation can be effectively coped with.
[0166] The embodiment of the application adopts the Next Left Peak function to jump and mark from the rightmost to the leftmost according to the index value order. The complete coverage and ordered marking of the peak and valley values are realized through the index value reverse order traversal, which not only avoids the jump direction confusion caused by noise, but also ensures the complete collection of all extreme value characteristics, and significantly improves the stability of the real-time measured signal peak and valley value tracking.
[0167] In some embodiments, after determining the peak value in the real-time measured signal, further comprising:
[0168] jump to the leftmost peak value in the plurality of real-time detected peak values from the highest peak value, and mark the corresponding peak value feature information thereof;
[0169] jump to each of the plurality of real-time detected peak values in sequence from the leftmost peak value according to the index values of the peak values, and mark the corresponding peak value feature information thereof at each time of jumping to the peak value, until stopping at the rightmost peak value in the plurality of real-time detected peak values.
[0170] Specifically, firstly, it is judged whether the current is in the highest peak value, if not, jump to the highest peak value by default, and mark the corresponding peak value feature information thereof. Then, the Next Right Peak function is executed.
[0171] jump to the leftmost peak value in the plurality of real-time detected peak values from the highest peak value, and mark the corresponding peak value feature information thereof.
[0172] Further, jump to each of the plurality of real-time detected peak values in sequence from the leftmost peak value according to the index values of the peak values from small to large, and mark the corresponding peak value feature information thereof at each time of jumping to the peak value, until stopping at the rightmost peak value in the plurality of real-time detected peak values and marking.
[0173] From the above, after determining the valley value in the real-time measured signal, further comprising:
[0174] jump to the leftmost valley value in the plurality of real-time detected valley values from the lowest valley value, and mark the corresponding valley value feature information thereof;
[0175] jump to each of the plurality of real-time detected valley values in sequence from the leftmost valley value according to the index values of the valley values, and mark the corresponding valley value feature information thereof at each time of jumping to the valley value, until stopping at the rightmost valley value in the plurality of real-time detected valley values.
[0176] The process of valley value jumping and marking is consistent with the process of peak value jumping and marking, and the specific process is as described above, which will not be repeated here.
[0177] It should be noted that the implementation of the Next Right Peak function forces to jump to the right. When using the Next Right Peak function, it is judged whether the next peak value / valley value to be jumped to is on the right side, if it is on the left side due to noise, the jumping function will be exited. In actual use, the signal-to-noise ratio of the measured signal is relatively high, and the jumping direction confusion caused by noise is not necessarily, and through the Next Right Peak function, the jumping direction confusion situation can be effectively coped with.
[0178] The embodiment of the present application adopts the Next Right Peak function to jump and mark from the rightmost side to the leftmost side according to the index value sequence. The complete coverage and ordered marking of the peak and valley values are realized through the index value sequence traversal, which not only avoids the confusion of the jump direction caused by the noise, but also ensures the non-missing collection of the full amount of extreme value features, and significantly improves the stability of the real-time measured signal peak and valley value tracking.
[0179] The following is an experimental effect diagram for the above-mentioned peak and valley value detection algorithm.
[0180] Figure 5 is the peak value detection effect schematic diagram of the general signal provided by the present application. Under the influence of 20dB additive Gaussian noise, there should be 19 theoretical peak values, 18 real peak values are actually detected, 2 false peak values are detected, and 1 real peak value is missed. The correctness rate of the detected peak value is 94.74%, the peak missing rate is 5.26%, and the false peak rate is 11.1%, which meets the needs of most actual measurement scenes.
[0181] Figure 6 is the valley value detection effect schematic diagram of the general signal provided by the present application. Under the influence of 20dB additive Gaussian noise, there should be 21 theoretical valley values, 19 real valley values are actually detected, 2 false valley values are detected, and 2 real valley values are missed. The correctness rate of the detected valley value is 90.48%, the valley missing rate is 9.52%, and the false valley rate is 10.53%, which meets the needs of most actual measurement scenes.
[0182] Figure 7 is the peak value detection effect schematic diagram of the square wave signal provided by the present application. Under the influence of 35dB additive Gaussian noise, only one peak value is detected on each square wave platform, which meets the needs of the actual scene. Among the 16 real peak values, 15 peak values are detected, and 1 peak value is missed. The correctness rate of the detected peak value is 93.57%, the peak missing rate is 6.25%, and the false peak rate is 0. This result meets the needs of most actual measurement scenes. The valley value detection effect is also consistent, which will not be described here.
[0183] The structure of the peak and valley value detection system provided by the present application will be described below. The peak and valley value detection system described below can be correspondingly referred to the peak and valley value detection method described above.
[0184] Referring to Figure 8 , Figure 8 is a structural schematic diagram of the peak and valley value detection system provided by the present application.
[0185] As Figure 8 shown, the peak and valley value detection system comprises:
[0186] The first determination module 810 is configured to compare the amplitude of each candidate data point with the amplitudes of the data points in the window length on the left and right sides of the candidate data point, and determine a first target evaluation weight value of the window length; the candidate data point is determined based on the window length and the array length; the array is formed based on the amplitudes corresponding to a plurality of data points in the real-time measured signal; and the first target evaluation weight value is used to reflect the effectiveness of detecting the peak value or the valley value under the condition of the window length.
[0187] The window selection module 820 is configured to increase the window length step by step, iteratively perform the step of comparing the amplitude of each candidate data point with the amplitudes of the data points in the window length on the left and right sides of the candidate data point, and determine a first target evaluation weight value of the window length, until the window length reaches a preset length, and select a best window length from the window lengths based on the first target evaluation weight values of the window lengths.
[0188] The second determination module 830 is configured to compare the amplitude of each target data point with the amplitudes of the data points in the best window length on the left and right sides of the target data point, and determine a second target evaluation weight value of each target data point; the target data point is determined based on the best window length and the array length; and the second target evaluation weight value is used to reflect the local prominence of the target data point as the peak value or the valley value.
[0189] The peak-valley value detection module 840 is configured to determine the peak value or the valley value in the real-time measured signal from the target data points based on the second target evaluation weight values of the target data points.
[0190] The peak-valley value detection system provided by the application first circulates through the incrementally increasing window length and calculates the first target evaluation weight value, dynamically evaluates the effectiveness of different window lengths on the peak-valley value detection, automatically selects the best window length that adapts to the current signal characteristics, does not need to rely on manual parameter setting, and significantly improves the universality in different signal scenarios; the second circulation compares the amplitudes of the target data points based on the best window length, quantifies the local prominence of the target data points as the peak value or the valley value through the second target evaluation weight value, can accurately capture the weak peak, and can effectively suppress the pseudo-peak interference; the synergy of the two circulation scores makes the window self-adaptive performance of the peak-valley value detection extremely high, while maintaining a low computational complexity to meet the real-time processing requirement, and improves the accuracy and efficiency of the peak-valley value detection.
[0191] Further, the first determination module 810 is further configured to:
[0192] compare the amplitude of each candidate data point with the amplitudes of the data points in the window length on the left and right sides of the candidate data point;
[0193] In the process of traversing all candidate data points, if the amplitude of the current candidate data point is greater than the amplitudes of the data points within the window length on the left and right sides of the current candidate data point, the first initial evaluation weight value of the window length is reduced until the first target evaluation weight value of the window length is obtained after the traversal is completed.
[0194] Further, the window selection module 820 is further configured to:
[0195] determine the window length corresponding to the minimum first target evaluation weight value among the first target evaluation weight values of the window lengths as the optimal window length.
[0196] Further, the peak-valley value detection module 840 is further configured to:
[0197] determine a plurality of peak values from the target data points based on the second target evaluation weight values of the target data points;
[0198] if the difference between the index values of two adjacent peak values is less than a preset value, merge the two adjacent peak values into one peak value to obtain a plurality of peak values in the real-time measured signal.
[0199] Further, the peak-valley value detection system is further configured to:
[0200] jump to the highest peak value and mark the corresponding peak value feature information thereof;
[0201] jump from the highest peak value to each peak value detected in real time in turn according to the target sorting result, and mark the corresponding peak value feature information thereof each time the peak value is jumped to; the target sorting result is updated based on the plurality of peak values detected in real time each time the jump is made; the target sorting result is obtained by sorting the peak values with equal amplitudes in ascending order according to the sizes of the index values corresponding to the peak values with equal amplitudes under the condition that there are at least two peak values with equal amplitudes in the initial sorting result; the initial sorting result is obtained by sorting the peak values in descending order based on the sizes of the amplitudes corresponding to the peak values.
[0202] Further, the peak-valley value detection system is further configured to:
[0203] jump from the highest peak value to the rightmost peak value among the plurality of peak values detected in real time and mark the corresponding peak value feature information thereof;
[0204] jump from the rightmost peak value to each peak value detected in real time in turn according to the order of the index values of the peak values, and mark the corresponding peak value feature information thereof each time the peak value is jumped to, until the jump is stopped at the leftmost peak value among the plurality of peak values detected in real time.
[0205] Further, the peak-valley value detection system is further configured to:
[0206] jump from the highest peak value to the leftmost peak value in the plurality of peak values detected in real time, and mark the corresponding peak feature information thereof;
[0207] In order of the index values of the peaks, sequentially jump from the leftmost peak value to each peak value detected in real time, and mark the corresponding peak feature information thereof at each time of jumping to a peak value, until stopping at the rightmost peak value in the plurality of peak values detected in real time.
[0208] It should be noted that the peak-valley value detection system provided by the present application can execute the peak-valley value detection method described in any of the above embodiments when actually running, and the present embodiment will not be described here.
[0209] Figure 9 is a structural schematic diagram of an electronic device provided by the present application, as shown in Figure 9 The electronic device can include a processor 910, a communications interface 920, a memory 930, and a communications bus 940, wherein the processor 910, the communications interface 920, and the memory 930 complete mutual communication through the communications bus 940. The processor 910 can invoke a logical instruction in the memory 930 to execute a peak-valley value detection method, which includes: traversing and comparing the amplitude of each candidate data point with the data points within the window length on the left and right sides thereof to determine a first target evaluation weight value of the window length; the candidate data point is determined based on the window length and the array length, and the array is composed of the amplitudes corresponding to a plurality of data points contained in the real-time measured signal; the first target evaluation weight value is used to reflect the effectiveness of detecting a peak value or a valley value under the condition of the window length; gradually increasing the window length, iteratively executing the step of traversing and comparing the amplitude of each candidate data point with the data points within the window length on the left and right sides thereof to determine the first target evaluation weight value of the window length, until the window length reaches a preset length, and selecting a best window length from each window length based on the first target evaluation weight value of each window length; traversing and comparing the amplitude of each target data point with the data points within the best window length on the left and right sides thereof to determine a second target evaluation weight value of each target data point; the target data point is determined based on the best window length and the array length; the second target evaluation weight value is used to reflect the local prominence of the target data point as a peak value or a valley value; determining the peak value or the valley value in the real-time measured signal from each target data point based on the second target evaluation weight value of each target data point.
[0210] Moreover, the logic instructions in the memory 930 described above can be implemented in the form of software functional units and sold or used as independent products, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0211] In another aspect, the present application also provides a computer program product, which comprises a computer program stored on a non-transitory computer readable storage medium, and the computer program comprises program instructions, when the program instructions are executed by a computer, the computer can execute the peak and valley value detection method provided by the above-mentioned embodiments, and the method comprises: comparing the amplitude of each candidate data point with the amplitude of the data points within the window length on the left and right sides of the candidate data point to determine a first target evaluation weight value of the window length; the candidate data point is determined based on the window length and the array length, and the array is composed of the amplitudes corresponding to a plurality of data points contained in the real-time measured signal; the first target evaluation weight value is used to reflect the effectiveness of detecting the peak value or the valley value under the condition of the window length; gradually increasing the window length, iteratively executing the step of comparing the amplitude of each candidate data point with the amplitude of the data points within the window length on the left and right sides of the candidate data point to determine the first target evaluation weight value of the window length, until the window length reaches a preset length, and selecting the best window length from the window lengths based on the first target evaluation weight values of the window lengths; comparing the amplitude of each target data point with the amplitude of the data points within the best window length on the left and right sides of the target data point to determine a second target evaluation weight value of each target data point; the target data point is determined based on the best window length and the array length; the second target evaluation weight value is used to reflect the local significance of the target data point as a peak value or a valley value; determining the peak value or the valley value in the real-time measured signal from the target data points based on the second target evaluation weight values of the target data points.
[0212] In yet another aspect, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program, which, when executed by a processor, implements a peak-valley value detection method provided by any of the above embodiments. The method comprises: comparing the amplitude of each candidate data point with the amplitudes of the data points within a window length on the left and right sides of the candidate data point, to determine a first target evaluation weight value of the window length; the candidate data point is determined based on the window length and an array length; the array is formed based on the amplitudes corresponding to a plurality of data points included in a real-time measured signal; the first target evaluation weight value is used to reflect the effectiveness of detecting a peak value or a valley value under the condition of the window length; gradually increasing the window length, iteratively performing the step of comparing the amplitude of each candidate data point with the amplitudes of the data points within a window length on the left and right sides of the candidate data point, to determine a first target evaluation weight value of the window length, until the window length reaches a preset length, and selecting a best window length from the window lengths based on the first target evaluation weight values of the window lengths; comparing the amplitude of each target data point with the amplitudes of the data points within the best window length on the left and right sides of the target data point, to determine a second target evaluation weight value of each target data point; the target data point is determined based on the best window length and the array length; the second target evaluation weight value is used to reflect the local significance of the target data point as a peak value or a valley value; and determining a peak value or a valley value in the real-time measured signal from the target data points based on the second target evaluation weight values of the target data points.
[0213] The system embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment. Those skilled in the art can understand and implement without creative labor.
[0214] From the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be implemented by means of software plus necessary general hardware platforms, and of course can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in terms of the contribution to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in the various embodiments or some parts of the embodiments.
[0215] It should be pointed out finally that the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit the same; and although the present application has been described in detail with reference to the foregoing embodiments, it should be appreciated by those skilled in the art that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features thereof can be replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A peak-to-valley value detection method, characterized by, The peak-valley value detection method comprises: comparing the amplitude of each candidate data point with the amplitude of the data points within the window length on the left and right sides of the candidate data point to determine a first target evaluation weight value of the window length, which comprises: comparing the amplitude of each candidate data point with the amplitude of the data points within the window length on the left and right sides of the candidate data point; during the process of traversing all candidate data points, if the amplitude of the current candidate data point is greater than the amplitude of the data points within the window length on the left and right sides of the candidate data point, the first initial evaluation weight value of the window length is reduced until the first target evaluation weight value of the window length is obtained after the traversal is completed; wherein the candidate data point is determined based on the window length and the array length, and the array is composed of the amplitudes corresponding to the multiple data points in the real-time measured signal; the first target evaluation weight value is used to reflect the effectiveness of detecting the peak value or the valley value under the condition of the window length; gradually increasing the window length, iteratively performing the step of comparing the amplitude of each candidate data point with the amplitude of the data points within the window length on the left and right sides of the candidate data point to determine a first target evaluation weight value of the window length, until the window length reaches a preset length, and selecting the best window length from the window lengths based on the first target evaluation weight values of the window lengths; comparing the amplitude of each target data point with the amplitude of the data points within the best window length on the left and right sides of the target data point to determine a second target evaluation weight value of each target data point; the target data point is determined based on the best window length and the array length; the second target evaluation weight value is used to reflect the local prominence of the target data point as a peak value or a valley value; determining the peak value or the valley value in the real-time measured signal from the target data points based on the second target evaluation weight values of the target data points, which comprises: determining multiple peak values from the target data points based on the second target evaluation weight values of the target data points; if the difference between the index values of two adjacent peak values is less than a preset value, merging the two adjacent peak values into one peak value to obtain multiple peak values in the real-time measured signal; the step of selecting the best window length from the window lengths based on the first target evaluation weight values of the window lengths comprises: determining the window length corresponding to the minimum first target evaluation weight value in the first target evaluation weight values of the window lengths as the best window length.
2. The peak-valley value detection method according to claim 1, characterized by, after determining the peak value in the real-time measured signal, further comprising: jumping to the highest peak value and marking the peak value characteristic information corresponding thereto; jumping from the highest peak value to each peak value detected in real time in turn according to a target sorting result, and marking the peak value characteristic information corresponding to each peak value at each time of jumping to the peak value; the target sorting result is updated based on the multiple peak values detected in real time at each time of jumping; the target sorting result is obtained by sorting the peak values with equal amplitudes in ascending order according to the index values corresponding to the peak values with equal amplitudes under the condition that there are at least two peak values with equal amplitudes in the initial sorting result; the initial sorting result is obtained by sorting the peak values in descending order based on the amplitudes corresponding to the peak values.
3. The peak-valley value detecting method according to claim 1, characterized by, After determining the peaks in the real-time measured signal, further comprising: Jumping from the highest peak to the leftmost peak in the real-time detected multiple peaks, and marking the corresponding peak feature information thereof; In order of the index values of each peak, sequentially jumping from the leftmost peak to each peak in the real-time detected multiple peaks, and marking the corresponding peak feature information thereof each time jumping to a peak until stopping at the rightmost peak in the real-time detected multiple peaks.
4. The peak-valley value detecting method according to claim 1, characterized by, After determining the peaks in the real-time measured signal, further comprising: Jumping from the highest peak to the rightmost peak in the real-time detected multiple peaks, and marking the corresponding peak feature information thereof; In order of the index values of each peak, sequentially jumping from the rightmost peak to each peak in the real-time detected multiple peaks, and marking the corresponding peak feature information thereof each time jumping to a peak until stopping at the leftmost peak in the real-time detected multiple peaks.
5. A peak-to-valley value detection system characterized by, Comprising: A first determination module, configured to compare the amplitude of each candidate data point with the amplitudes of data points within a window length on the left and right sides of the candidate data point, and determine a first target evaluation weight value of the window length, wherein when detecting peaks, the comparison comprises comparing the amplitude of each candidate data point with the amplitudes of data points within a window length on the left and right sides of the candidate data point; during the process of traversing all candidate data points, if the amplitude of the current candidate data point is greater than the amplitudes of data points within the window length on the left and right sides of the candidate data point, the first initial evaluation weight value of the window length is reduced until the first target evaluation weight value of the window length is obtained after the traversal is completed; The candidate data points are determined based on the window length and the array length, and the array is composed of amplitudes corresponding to multiple data points in the real-time measured signal; the first target evaluation weight value is used to reflect the effectiveness of detecting peaks or valleys under the condition of the window length; A window selection module, configured to gradually increase the window length, iteratively perform the step of comparing the amplitude of each candidate data point with the amplitudes of data points within a window length on the left and right sides of the candidate data point, and determine a first target evaluation weight value of the window length, until the window length reaches a preset length, and select an optimal window length from the window lengths based on the first target evaluation weight values of the window lengths; A second determination module, configured to compare the amplitude of each target data point with the amplitudes of data points within the optimal window length on the left and right sides of the target data point, and determine a second target evaluation weight value of each target data point; the target data points are determined based on the optimal window length and the array length; the second target evaluation weight value is used to reflect the local prominence of the target data point as a peak or a valley; A peak-valley detection module, configured to determine peaks or valleys in the real-time measured signal from the target data points based on the second target evaluation weight values of the target data points, wherein when detecting peaks, the peak-valley detection module comprises: determining multiple peaks from the target data points based on the second target evaluation weight values of the target data points; if the difference between the index values of two adjacent peaks is less than a preset value, the two adjacent peaks are combined into one peak, and multiple peaks in the real-time measured signal are obtained. The first target evaluation weight value based on each window length selects an optimal window length from each window length, and the method comprises the following steps: The window length corresponding to the minimum first target evaluation weight value in the first target evaluation weight values of each window length is determined as the optimal window length.
6. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein The processor executes the computer program to realize the steps of the peak-valley value detection method according to any one of claims 1 to 4.
7. A non-transitory computer-readable storage medium having stored thereon a computer program, wherein The computer program is executed by the processor to realize the steps of the peak-valley value detection method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Data processing method and device, storage medium and electronic equipment
CN111797880A
Multi-scale filtering weighted peak value extraction method
CN115795349A