Method and system for calculating sine and harmonic signal envelope, and medium

By calculating the instantaneous fundamental frequency and performing bidirectional smoothing, a first-order feedback filter is used to estimate the envelope of sinusoidal and harmonic signals, solving the problem of inaccurate estimation in existing technologies and achieving efficient and accurate tracking of the signal envelope.

CN121690435APending Publication Date: 2026-03-17DONG GUAN CHENG QIAN YIN XIANG KE JI YOU XIAN GONG SI
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-18
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Existing technologies are insufficient in terms of adaptability, accuracy, and ease of configuration, making it difficult to efficiently and accurately estimate the envelope of sinusoidal and harmonic signals. In particular, envelope estimation lag or step-like distortion problems exist when processing variable fundamental frequency signals.

Method used

By acquiring the instantaneous fundamental frequency of the input signal and calculating the instantaneous envelope analysis window length, a first-order feedback filter is used to smooth the upper and lower envelopes based on a bidirectional smoothing method. The filter coefficients are dynamically calculated according to the instantaneous fundamental frequency to achieve efficient and accurate estimation of the signal envelope.

Benefits of technology

It effectively tracks changes in signal amplitude, improves the accuracy and smoothness of envelope extraction, and achieves efficient and accurate estimation of the envelope of sinusoidal and harmonic signals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121690435A_ABST
    Figure CN121690435A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a system for calculating sine and harmonic signal envelopes and a medium. The technical scheme of the invention comprises the following steps: acquiring a sine or harmonic input signal; calculating an instantaneous fundamental frequency of the signal, and determining an instantaneous fundamental frequency value based on the fundamental frequency change mode and the control parameters; calculating an instantaneous envelope analysis window length according to the instantaneous fundamental frequency, the sampling rate and a preset window period number; based on the window length, a symmetric analysis window is constructed with each sampling point as the center, and the maximum value and the minimum value of signals in the window are calculated to serve as an upper envelope and a lower envelope respectively; and finally, performing bidirectional smoothing processing on the upper envelope and the lower envelope, including forward and reverse smoothing filtering, and dynamically calculating a filter coefficient according to an instantaneous fundamental frequency to obtain a smoothed signal envelope. The method can effectively track the change of signal amplitude, improves the accuracy and smoothness of envelope extraction, and has the beneficial effect of efficiently and accurately estimating the envelope of sine and harmonic signals.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of signal processing technology, and in particular to a method, system, and medium for calculating the envelope of sinusoidal and harmonic signals. Background Technology

[0002] In signal analysis, it is often necessary to monitor and track changes in signal amplitude over time. Signal amplitude is a key indicator of signal strength. However, the instantaneous level of a signal oscillates rapidly between positive and negative peaks, failing to stably reflect the overall strength of the signal. Therefore, envelope detectors are widely used to track signal amplitude, thus providing a more stable representation of signal strength.

[0003] Existing general-purpose envelope detectors are applicable to various signal types, but their configurations are usually complex and require optimization for specific signal characteristics; otherwise, inaccurate estimations may occur. Especially for sinusoidal and harmonic signals, whose fundamental frequency may vary over time (such as swept-frequency signals), general-purpose envelope detectors struggle to achieve optimal performance without complex configurations.

[0004] In addition, existing envelope detection methods often suffer from problems such as envelope estimation lag or step-like distortion when processing variable fundamental frequency signals, which affect estimation accuracy and real-time performance.

[0005] Therefore, existing technologies are insufficient in terms of adaptability, accuracy, and ease of configuration, and have technical defects that make it difficult to efficiently and accurately estimate the envelope of sinusoidal and harmonic signals. Summary of the Invention

[0006] The main objective of this invention is to propose a method, system, and medium for calculating the envelope of sinusoidal and harmonic signals, aiming to solve the shortcomings of existing technologies in terms of adaptability, accuracy, and ease of configuration, and the technical problem that it is difficult to efficiently and accurately estimate the envelope of sinusoidal and harmonic signals.

[0007] To achieve the above objectives, this invention proposes a method for calculating the envelope of sinusoidal and sine wave signals, comprising the following steps:

[0008] Acquire an input signal, wherein the input signal is a sinusoidal signal or a harmonic signal;

[0009] Calculate the instantaneous fundamental frequency of the input signal;

[0010] Calculate the instantaneous envelope analysis window length based on the instantaneous fundamental frequency;

[0011] Based on the instantaneous envelope analysis window length, calculate the bilateral envelope of the input signal, including the upper envelope and the lower envelope;

[0012] The upper and lower envelopes are subjected to bidirectional smoothing to obtain a smoothed signal envelope.

[0013] Furthermore, the step of calculating the instantaneous fundamental frequency includes: determining the fundamental frequency variation mode according to the type of the input signal, wherein the mode includes a constant fundamental frequency, a linearly varying fundamental frequency, or an exponentially varying fundamental frequency; and calculating the instantaneous fundamental frequency value at each sampling moment based on the fundamental frequency variation mode and the control parameters of the signal.

[0014] Furthermore, the control parameters include signal sampling rate, signal length, start frequency, and stop frequency.

[0015] Furthermore, based on the signal sampling rate fs, the instantaneous fundamental frequency f(n), and the preset number of analysis window periods Nper, the analysis window length w(n) at each moment is calculated using the following formula:

[0016]

[0017] Furthermore, for each sampling point n, a symmetrical analysis window centered on the instantaneous envelope analysis window length is determined; within the analysis window, the maximum value of the signal is calculated as the upper envelope value of the sampling point, and the minimum value of the signal is calculated as the lower envelope value of the sampling point.

[0018] Furthermore, the bidirectional smoothing process includes sequentially performing forward smoothing filtering and reverse smoothing filtering on the upper and lower envelopes to obtain the final smooth envelope.

[0019] Furthermore, the forward smoothing filter and the reverse smoothing filter are implemented using a first-order feedback filter, and the filter coefficients of the first-order feedback filter are dynamically calculated based on the instantaneous fundamental frequency.

[0020] Furthermore, the calculation of the filter coefficients includes:

[0021] Calculate the time constant related to the instantaneous fundamental frequency:

[0022]

[0023] The constant 0.66 is used to ensure that the smoothing filter can reach a new signal amplitude within N cycles of the test signal's fundamental frequency, Nper is the preset window period number, and f(n) is the instantaneous fundamental frequency.

[0024] Calculate the intermediate coefficients:

[0025]

[0026] Where fs is the sampling rate;

[0027] Calculate the filter coefficients:

[0028]

[0029]

[0030] The present invention also proposes a signal processing system, including a signal acquisition module and a processor, wherein the signal acquisition module is used to acquire input signals, and the processor operates using the method described above.

[0031] The present invention also proposes a computer-readable storage medium comprising a stored computer program, wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to perform the method as described above.

[0032] The technical solution of this invention includes acquiring a sinusoidal or harmonic input signal; calculating the instantaneous fundamental frequency of the signal, and determining the instantaneous fundamental frequency value based on the fundamental frequency variation mode and control parameters; calculating the instantaneous envelope analysis window length according to the instantaneous fundamental frequency, sampling rate, and preset window period number; constructing a symmetrical analysis window centered on each sampling point based on the window length, calculating the maximum and minimum values ​​of the signal within the window, which are respectively used as the upper and lower envelopes; and finally performing bidirectional smoothing processing on the upper and lower envelopes, including forward and backward smoothing filters, with the filter coefficients dynamically calculated based on the instantaneous fundamental frequency to obtain the smoothed signal envelope. This invention can effectively track signal amplitude changes, improve the accuracy and smoothness of envelope extraction, and has the beneficial effect of efficiently and accurately estimating the envelope of sinusoidal and harmonic signals. Attached Figure Description

[0033] Figure 1 This is a diagram showing the envelope detection results using only forward smoothing filtering;

[0034] Figure 2 This is an overall flowchart of the present invention;

[0035] Figure 3 This is a test signal according to an embodiment of the present invention and its upper and lower envelopes calculated by an envelope detector;

[0036] Figure 4 for Figure 3 A diagram comparing the amplitudes of the upper and lower envelopes;

[0037] Figure 5 This is the envelope detection effect of the envelope detector of the present invention when configured with an accurate instantaneous fundamental frequency;

[0038] Figure 6 The calculated, unsmoothed, coarse upper and lower envelopes;

[0039] Figure 7 This is a signal flow diagram of the low-pass smoothing filter used in the embodiments of the present invention;

[0040] Figure 8 To Figure 6 The image shows the final effect of applying bidirectional smoothing to the coarse envelope.

[0041] Figure 9 A schematic diagram showing step-like distortion in envelope estimation when the fundamental frequency configured for the envelope detector is lower than the actual fundamental frequency of the signal;

[0042] Figure 10 A schematic diagram showing jitter in envelope estimation when the fundamental frequency configured for the envelope detector is higher than the actual fundamental frequency of the signal;

[0043] Figure 11 The envelope effect without any smoothing filter applied;

[0044] Figure 12 This is the envelope effect achieved using only forward smoothing filtering;

[0045] Figure 13 This represents the final envelope detection result of the complete method of this invention. Detailed Implementation

[0046] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0047] It should be noted that if the embodiments of the present invention involve directional indicators (such as up, down, left, right, front, back, top, bottom, inside, outside, vertical, horizontal, longitudinal, counterclockwise, clockwise, circumferential, radial, axial, etc.), the directional indicators are only used to explain the relative positional relationship and movement of the components in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicators will also change accordingly.

[0048] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.

[0049] This invention proposes a method, system, and medium for calculating the envelope of sinusoidal and harmonic signals.

[0050] In embodiments of the present invention, such as Figures 1 to 13 As shown, the method described in this invention is typically integrated as a software module into a larger signal processing or measurement system. This module receives the input signal acquired by the signal acquisition system, processes it, and outputs the upper and lower envelopes of the signal. This method is particularly suitable for envelope analysis of sinusoidal signals, harmonic signals, and signals whose fundamental frequency varies with time (such as swept-frequency signals). Figure 2 The overall flowchart of the present invention is shown, clarifying the core processing steps from signal input to envelope output. The complete process of the signal envelope calculation method includes the following steps, which together constitute the complete technical system of the present invention:

[0051] S100: Signal Acquisition

[0052] Acquire the input signal x to be analyzed. This signal can be a measured signal from a sensor (such as the sound pressure level or acceleration response of a loudspeaker) or a standard test signal synthesized by a signal generator (such as a linear sweep frequency or an exponential sweep frequency signal). The input signal is discrete in time, and its sampling rate is f. s The total number of samples is N.

[0053] S200: Instantaneous Fundamental Frequency Calculation

[0054] The purpose of this step is to obtain the instantaneous fundamental frequency f(n) of the input signal at each sampling point n. This is crucial for achieving high-precision envelope detection. (See attached image.) Figure 5 As shown, the envelope detector achieves optimal tracking performance when an accurate instantaneous fundamental frequency is configured. Conversely, as shown in the attached diagram... Figure 9 and attached Figure 10 As shown, when the configured fundamental frequency is lower or higher than the actual fundamental frequency of the signal, the estimated envelope exhibits significant step-like distortion or jitter, verifying the necessity of this step. In specific implementations, different calculation models can be used based on prior knowledge of the signal. It should be noted that in some other embodiments of the present invention, when prior knowledge of the test signal characteristics is lacking, the instantaneous fundamental frequency can also be determined and estimated through signal cross-correlation or other applicable calculation methods. The following is a detailed description of the use of calculation models based on prior knowledge:

[0055] S210: Constant Fundamental Frequency Model

[0056] If the fundamental frequency of the signal is constant, then the instantaneous fundamental frequency is a constant: f(n) = f c , where f c The fundamental frequency is known.

[0057] S220: Linearly varying fundamental frequency model

[0058] For a linearly swept frequency signal, its instantaneous frequency changes linearly with time. Based on the signal parameters (starting frequency f)... start Termination frequency f stop Sampling rate f s The instantaneous fundamental frequency (based on signal length N) is calculated as follows:

[0059] 1. Calculate the time array:

[0060]

[0061] Where, 0≤n <N

[0062] 2. Calculate the initial and final angular frequencies:

[0063]

[0064]

[0065] 3. Calculate the instantaneous fundamental frequency:

[0066]

[0067] S230: Exponentially Changing Fundamental Frequency Model

[0068] For an exponentially swept frequency signal, its instantaneous frequency varies exponentially with time. Based on the same signal parameters, the instantaneous fundamental frequency is calculated as follows:

[0069] 1. Similarly, calculate the time array t(n) and angular frequency ω. start and ω stop .

[0070] 2. Calculate the intermediate coefficients:

[0071]

[0072]

[0073] 3. Calculate the instantaneous fundamental frequency:

[0074]

[0075] Note: The above exponential model formula is one possible implementation method. Its core lies in using the logarithm of the ratio of angular frequencies to construct the exponential relationship.

[0076] S300: Instantaneous Analysis Window Length Calculation

[0077] Envelope detection is achieved through local analysis of the signal. To ensure that each analysis window contains at least one complete signal cycle and can smoothly track amplitude changes, the length w(n) of the analysis window needs to be dynamically adjusted with the instantaneous fundamental frequency. Its calculation formula is as follows:

[0078]

[0079] Where, N per This is the preset number of window periods to ensure the window covers more than one period, enhancing stability. It also defines the analysis window length of the envelope detector, specifically the number of periods of the fundamental frequency of the analyzed signal. Furthermore, N... per It can also be in decimal form; for example, 0.9, 1, and 1.2 are all decimals of N. per The effective value of is preferably 1.1, which achieves a good balance between the response speed and detection accuracy of the envelope detector to changes in signal amplitude; ceil is an up-rounding function used to ensure that the window length is an integer number of samples.

[0080] S400: Bilateral Envelope Calculation

[0081] This step calculates the upper envelope (env) of the signal. upper and lower envelope env lower As attached Figure 6 As shown, this step directly calculates an unsmoothed, step-shaped rough envelope.

[0082] The specific steps are as follows, for each sampling point n:

[0083] 1. Calculate the half-width of the window:

[0084]

[0085] Where fix is ​​the function that rounds to zero.

[0086] 2. Determine the start and end sample indices of the analysis window:

[0087]

[0088]

[0089] 3. Perform boundary checks on the index to ensure it does not exceed the signal range:

[0090]

[0091]

[0092] 4. In the analysis window x[w start (n)…w stop Within [n], calculate:

[0093]

[0094]

[0095] Thus, a preliminary, step-like bilateral envelope was obtained. (Appendix) Figure 11 The result shows the envelope effect without any smoothing applied, consistent with the result of this step, highlighting the necessity of subsequent smoothing.

[0096] S500: Two-way smoothing processing

[0097] To eliminate the staircase effect generated in the S400 and to make the envelope curve more smoothly track the true changes in signal amplitude, smoothing filtering is required. This invention employs bidirectional smoothing to eliminate the time shift (phase lag) caused by unidirectional filtering. Specifically, bidirectional smoothing processing includes sequentially performing forward smoothing filtering and reverse smoothing filtering on the upper and lower envelopes to obtain the final smooth envelope. The specific execution order of forward and reverse smoothing filtering is not limited; the execution order of forward and reverse smoothing can be arbitrarily arranged, and the final result obtained by combining the two arrangements is the same. Therefore, in actual operation, forward smoothing filtering or reverse smoothing filtering can be performed first. (See attached...) Figure 1 and attached Figure 12 As shown, if only forward smoothing is used, the envelope curve will exhibit significant time lag. This invention successfully solves this problem through bidirectional smoothing, achieving the effect shown in the attached figure. Figure 3 Appendix Figure 8 and attached Figure 13 The precise tracking effect shown.

[0098] S510: Filter Coefficient Calculation

[0099] The smoothing filter employs a first-order infinite impulse response (IIR) low-pass filter. Its time constant must vary with the instantaneous fundamental frequency to ensure consistent smoothing performance across different frequencies. Specifically, the time constant guarantees that the envelope accurately and without delay tracks the signal amplitude. This is a characteristic of low-pass filters, and the smoothing algorithm utilizes this type of filter.

[0100]

[0101]

[0102] The filter coefficients are then:

[0103]

[0104]

[0105] The difference equation for the filter is: The structure of the filter can be found in the appendix. Figure 7 The signal flow graph.

[0106] S520: Forward Smoothing

[0107] This section lists the cases where forward smoothing is performed first, followed by reverse smoothing. First, the initially calculated en is... vupper and env lower As the input signal x, using the above filter, in time sequence Filtering is performed to obtain the forward smoothing result e. nvupper,f and env lower,f .

[0108] S530: Reverse Smoothing

[0109] Reverse the aforementioned forward smoothing result When the input is fed into the same filter, the inverse smoothing result env is obtained. upper,r and env lower,r .

[0110] Appendix Figure 6 Appendix Figure 8 and attached Figure 13 Together they demonstrated the complete transformation process from a coarse envelope to a final smooth envelope, proving the effectiveness of bidirectional smoothing.

[0111] Understandably, this method, as a high-precision signal analysis tool, can be widely applied in fields such as communications, audio engineering, and vibration analysis. A typical application is as a core sub-module in a "loudspeaker voice coil offset detection system." In this system, this module is responsible for calculating the envelope of the response signal (such as sound pressure or acceleration) generated by the loudspeaker playing a test signal (such as a sweep frequency signal). The obtained accurate envelope data will be used by subsequent modules to calculate the envelope offset and envelope tilt, and finally estimate the voice coil offset through polynomial transformation, thereby achieving rapid quality inspection on the production line.

[0112] This invention also proposes a signal processing system, including a signal acquisition module and a processor. The signal acquisition module is used to acquire input signals, and the processing system operates using the method for calculating the envelope of sine and sine waves as described in any of the above embodiments. Since this system employs all the technical solutions of all the embodiments described above, it possesses at least all the beneficial effects brought about by the technical solutions of the above embodiments, which will not be elaborated upon here.

[0113] The present invention also proposes a computer-readable storage medium comprising a stored computer program, wherein, when the computer program is executed, it controls the device or apparatus containing the computer-readable storage medium to perform the method for calculating the envelope of a sine wave and a sine wave signal as described in any of the above embodiments. Since this computer-readable storage medium employs all the technical solutions of all the embodiments described above, it possesses at least all the beneficial effects brought about by the technical solutions of the above embodiments, which will not be elaborated upon here.

[0114] The above description is merely a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural transformations made using the contents of the present invention's specification and drawings under the inventive concept of the present invention, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.

Claims

1. A method of calculating a sinusoidal and harmonic signal envelope, characterized by, The method comprises the following steps: acquiring an input signal, the input signal being a sinusoidal signal or a harmonic signal; calculating an instantaneous fundamental frequency of the input signal; calculating an instantaneous envelope analysis window length based on the instantaneous fundamental frequency; calculating a double-sided envelope of the input signal based on the instantaneous envelope analysis window length, the double-sided envelope comprising an upper envelope and a lower envelope; performing bidirectional smoothing processing on the upper envelope and the lower envelope to obtain a smoothed signal envelope.

2. The method of claim 1, wherein, The step of calculating the instantaneous fundamental frequency comprises: determining a fundamental frequency variation mode of the input signal according to a type of the input signal, the mode comprising a constant fundamental frequency, a linearly varying fundamental frequency or an exponentially varying fundamental frequency; and calculating an instantaneous fundamental frequency value at each sampling time based on the fundamental frequency variation mode and a control parameter of the signal.

3. The method of claim 2, wherein, The control parameter comprises a signal sampling rate, a signal length, a starting frequency and a terminal frequency.

4. The method of claim 1, wherein, According to the signal sampling rate f s , the instantaneous fundamental frequency f(n) and the preset number of analysis window periods N per , the length of the analysis window w(n) at each moment is calculated by the following formula:

5. The method of claim 1, wherein, For each sampling point n, a symmetric analysis window centered on the instantaneous envelope analysis window length is determined; and within the analysis window, a maximum value of the signal is calculated as an upper envelope value of the sampling point, and a minimum value of the signal is calculated as a lower envelope value of the sampling point.

6. The method of claim 5, wherein: The bidirectional smoothing processing comprises sequentially performing forward smoothing filtering and reverse smoothing filtering on the upper envelope and the lower envelope to obtain a final smoothed envelope.

7. The method of claim 6, wherein: The forward smoothing filtering and the reverse smoothing filtering are implemented by using a first-order feedback filter, and filter coefficients of the first-order feedback filter are dynamically calculated according to the instantaneous fundamental frequency.

8. The method of claim 6, wherein, The calculation of the filter coefficients comprises: calculating a time constant related to the instantaneous fundamental frequency: wherein, a constant 0.66 is used to ensure that the smoothing filter can reach a new signal amplitude within N periods of the test signal fundamental frequency, calculating an intermediate coefficient: N per is the preset window period number, and f(n) is the instantaneous fundamental frequency. calculating a filter coefficient: where f s is the sampling rate; The signal acquisition module is configured to acquire an input signal, and the processor is configured to work according to the method in any one of claims 1 to 8.

9. A signal processing system comprising a signal acquisition module and a processor, characterized in that, The computer readable storage medium comprises a stored computer program, wherein the computer readable storage medium controls a device in which the computer readable storage medium is located to perform the method in any one of claims 1 to 8 when the computer program is running.

10. A computer-readable storage medium, characterized in that, ​