5428 views|27 replies

9717

Posts

24

Resources
The OP
 

When processing this signal, how do we calculate Z if we know the coordinates of Z-1, Z0, and Z1? [Copy link]

 

Page 8 of the attachment manual says that the index value of point Z is obtained by interpolating Z-1, Z0, and Z1. How should the interpolation of these three points Z-1, Z0, and Z1 be performed?

Ultrasonic sensing subsystem reference design for gas flow measurement.pdf (4.3 MB, downloads: 8)

Latest reply

Please use the formula in my post on the 15th floor to calculate, and you can discard items that have little impact on the result. Delta is just based on the picture in your first post. Any number of sampling points can be used, but two points must be guaranteed: (1) The interpolation function corresponding to each sampling point is centered at it. (2) The sampling point closest to the time to be solved is used first.   Details Published on 2019-8-2 20:11
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 

1372

Posts

2

Resources
2
 

The sinc function is used to interpolate the continuous signal (within the bandwidth constraint) from the discrete signal, which is simplified here to interpolate using only three points.

Comments

I found some information online, which mentioned inserting zeros first and then low-pass filtering. Is this the way it should be?  Details Published on 2019-7-30 14:28
 
 
 

9717

Posts

24

Resources
3
 
This post was last edited by littleshrimp on 2019-7-30 14:43
cruelfox posted on 2019-7-30 14:10 The sinc function is used to interpolate the continuous signal (under bandwidth constraints) from the discrete signal, which is simplified here to use only three points for interpolation.

I found some information online, which mentioned inserting zeros first and then low-pass filtering. Is this the way it should be?

Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

975

Posts

2

Resources
4
 
This post was last edited by Feihong Haojie on 2019-7-30 16:19

Interpolate 0 and then filter. I don't know if this is what it means.

Comments

This is the case for the insertion of 0 on the Internet, but I don't know whether the maximum index obtained after filtering the signal will have a large error. Theoretically, when the frequency is known, the waveform should be restored through three points, such as y=f(x). In this way, inputting an x can get the corresponding amplitude. Several equations are listed and ma  Details Published on 2019-7-30 16:54
 
 
 

9717

Posts

24

Resources
5
 
Feihong Haojie published on 2019-7-30 16:07 Interpolate 0, then filter, I don't know if this is what you mean
This is the case with interpolating 0 on the Internet, but I don't know if there will be a big error in the maximum index of the signal after filtering. Theoretically, when the frequency is known, the waveform should be restored through three points, such as y=f(x). In this way, by inputting an x, the corresponding amplitude can be obtained. I listed several equations and tried it several times with matlab, but it didn't work.

Comments

Theoretically, using the sampling theorem, if the infinite length signal is satisfied, the sampling rate can be doubled to restore it. In fact, the signal is not infinitely long. It seems that the waveform reproduction of the oscilloscope generally requires 12 times oversampling. I don't know what the application environment of the shrimp version is like...Anti-aliasing filters must be added before sampling analog signals  Details Published on 2019-7-30 18:27
 
 
 

975

Posts

2

Resources
6
 
This post was last edited by Feihong Haojie on 2019-7-30 18:30
littleshrimp published on 2019-7-30 16:54 This is the case with the online insertion 0, but I don't know if there will be a big error in the maximum value index obtained by the filtered signal. Theoretically, in the...

Theoretically, using the sampling theorem, if the infinite length signal is satisfied, the sampling rate can be doubled to restore it. In fact, the signal is not infinitely long. The waveform reproduction of the oscilloscope generally requires about 10 times oversampling. I don't know what the application environment of the shrimp version is like...Anti-aliasing filters must be added before sampling analog signals

Comments

According to the manual, realize ultrasonic measurement of time difference  Details Published on 2019-7-30 18:56
 
 
 

7452

Posts

2

Resources
7
 
This post was last edited by freebsder on 2019-7-30 18:48

After a rough look, I found that this is not the processing of the signal itself, nor is it to restore the signal, let alone filtering. It has already been transformed into the correlation processing of the sampling points. Although your thing is called interpolation, the actual meaning is mostly to express the estimation of a maximum value in a probabilistic sense. You see, the expression of time is the maximum correlation measured - m + the actual (estimated) maximum correlation, which has nothing to do with the signal.

There is no need to know the specific algorithm too clearly. After all, such a large company relies on this to make a living. It is already very open to tell you the principle. The schematic diagram does not mean that the actual correlation graph is such an ideal cosine.

Comments

The linear correlation calculation has been tested according to the manual. After the correlation operation, the index of the maximum value is obtained by subtracting m, and then the time difference between the two signals can be obtained by the sampling rate. Because of the limitation of the ADC sampling rate, the accuracy of the time difference will be affected. I don't understand the mathematics very well.  Details Published on 2019-7-30 19:04
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

9717

Posts

24

Resources
8
 
Feihong Haojie posted on 2019-7-30 18:27 Littleshrimp posted on 2019-7-30 16:54 This is the case for the plug-in 0 on the Internet, but I don’t know the maximum value obtained by this filtered signal...

According to the manual, realize ultrasonic measurement of time difference

Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

9717

Posts

24

Resources
9
 
freebsder posted on 2019-7-30 18:47 After a rough look, you can see that this is not the processing of the signal itself, nor is it to restore the signal, let alone filtering. It has been transformed into the correlation processing of the sampling points...

The linear correlation calculation has been tested according to the manual.

After two signals of the same frequency are correlated, the index of the maximum value minus m is obtained, and then the time difference of the two signals can be obtained by using the sampling rate.

Because the time difference accuracy will be affected by the limitation of ADC sampling rate

I don't understand the math, but the green waveform below is what the two signals look like after linear correlation, and it feels like it has the same frequency as the original signal.

Here we first assume that the frequency is the same as the original signal, and see if we can restore the corresponding signal with the same amplitude as the period of the sampling point through 3 sampling points.

Comments

The image is very good, there is no interference. Just take a few more samples, invert the expression and find the extreme value.  Details Published on 2019-7-30 19:12
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

7452

Posts

2

Resources
10
 
littleshrimp posted on 2019-7-30 19:04 The linear correlation calculation has been tested according to the manual. After the correlation operation of two signals of the same frequency, the index of the maximum value is subtracted from m and then...

The image is very good, there is no interference. Just take a few more samples, invert the expression and find the extreme value.

Comments

I have no idea. I thought I could get something like y=f(x,y1,y2,y3) by using Matlab to calculate the system of equations. Maybe I didn't list the equations correctly, so I haven't been able to calculate the result.  Details Published on 2019-7-30 19:17
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

9717

Posts

24

Resources
11
 
freebsder posted on 2019-7-30 19:12 The image is very good, there is no interference. Just take a few more samples and invert the expression to find the extreme value.

I have no idea.

I originally thought that I could get something like y=f(x,y1,y2,y3) by calculating the system of equations using Matlab.

Maybe the equation is not listed correctly, and the result has not been calculated.

Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

1372

Posts

2

Resources
12
 

This is too complicated. This interpolation uses three points (theoretically, accurate restoration requires all sampling points), and the calculation is like this:

According to the figure, assuming that the sampling interval is 1 (otherwise \deltanormalize it),

Z=Z_0\frac{\sin(\pi\cdot\delta)}{\pi\cdot\delta}+Z_1\frac{\sin(\pi(1+\delta))}{\pi(1+\ delta)}+Z_{-1}\frac{\sin(\pi(1-\delta))}{\pi(1-\delta)}

en, the forum \LaTeXeditor is OK.

Comments

I generated a set of data, and then selected 3 points as -1, 0, and 1. I substituted these three data into your formula, and the result I got was very different from the actual result. Did I make a mistake somewhere? The attachment is the test EXCEL file   Details Published on 2019-7-30 21:33
 
 
 

9717

Posts

24

Resources
13
 
cruelfox posted on 2019-7-30 20:13 You are overthinking it. This interpolation uses three points (theoretically, accurate restoration requires all sampling points), so it is calculated like this: According to the figure, assuming...

I generated a set of data and then selected 3 points as -1, 0, 1

Substituting these three data into your formula, the result is very different from the actual result.

Did I make a mistake somewhere? The attachment is the EXCEL file of the test

cruelfox.xlsx (24.37 KB, downloads: 0)

Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

1372

Posts

2

Resources
14
 

The disadvantage of using a small number of points for interpolation is that the error is obvious. The one you tested is exactly in the middle of two adjacent samples, which is the case with the largest error.

If you use 4 points, 5 points... for interpolation calculation, the error will gradually decrease.

The second one is ridiculously different because delta is negative. The formula needs to be modified and cannot be applied directly.

 
 
 

1372

Posts

2

Resources
15
 

Let me briefly explain why this is calculated.

To obtain a discrete signal from a continuous signal, a generalized function is used - a series of unit pulses modulated \sum_n \delta(t-nT)with the source signal (that is, multiplied) to obtain a generalized function , where the coefficients are the sampled discrete signal.x(t)x_\mathrm{d}(t)=\sum_n x[n]\delta(t-nT)x[n]

But the spectrum of the generalized function x_\mathrm{d}(t)is a mixture of the source signal spectrum.

To recover the source signal from the discrete signal (PCM modulated coefficients), an ideal filter is needed, assuming that the spectrum of the source signal is limited to the Nyquist frequency band h(t). It is in the form of a sinc function in the time domain:h(t)=\frac{\sin(\pi t/T)}{\pi t/T}

Now we need the value x(t)at any time \tau, so we do the convolution operation to findx_\mathrm{d}*h(\tau)

x_\mathrm{d}*h(\tau)=\int x_\mathrm{d}(t)h(\tau-t)dt=\int\sum_n x[n]\delta(t-nT)h( \tau-t)dt

=\sum_n x[n]\int\delta(t-nT)h(\tau-t)dt=\sum_n x[n]h(\tau-nT)

=\sum_n x[n] \frac{\sin(\pi\tau/Tn\pi)}{\pi\tau/Tn\pi}

Completely reconstructing the signal requires calculating the sum of infinite terms, but generally only finite terms are calculated, because the sinc function is attenuated on both sides, and a portion of n is used to calculate the error tolerance of the result. However, calculating only three terms is indeed a bit rough.

 
 
 

1372

Posts

2

Resources
16
 

Also, if the frequency of the signal is not high (much lower than the sampling frequency), you can use polynomial interpolation to fit the curve locally and find the value at any time. In this way, four or five sampling points are enough. The advantage is that the amount of calculation is much smaller and there is no need to calculate trigonometric functions.

 
 
 

9717

Posts

24

Resources
17
 
cruelfox posted on 2019-7-30 23:27 The disadvantage of using a small number of points for interpolation is that the error is obvious. The one you tested is exactly in the middle of two adjacent samples, which is the case with the largest error. For example...

I calculated all the points, selected 9.7 for delta, and then summed the data in column d.

The result should theoretically be between 96 and 19, but the actual result is 0.69

I tried it several times and the results were not related to the ideal value. It doesn't seem to be a problem of error.

cruelfox.xlsx (24.89 KB, downloads: 1)

Comments

No. delta is the distance between the position to be calculated and the nearest sampling point. The maximum value can only be 0.5. According to your table, if you want to calculate the value of 9.7, the coefficient of the c column is wrong. The c corresponding to a=9 is 0.3679, and the c corresponding to a=10 is 0.8584. The interpolated value at 9.7 is 35.0592  Details Published on 2019-8-1 13:05
No. delta is the distance between the position to be calculated and the nearest sampling point. The maximum value can only be 0.5. According to your table, if you want to calculate the value of 9.7, the coefficient of the c column is wrong. The c corresponding to a=9 is 0.3679, and the c corresponding to a=10 is 0.8584. The interpolated value at 9.7 is 35.0592  Details Published on 2019-8-1 13:02
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

1372

Posts

2

Resources
18
 
littleshrimp posted on 2019-7-31 08:23 I calculated all the points, selected 9.7 for delta, and then summed the data in column d. Theoretically, the result should be between 96 and 19, but the actual result is 0. ...

No. delta is the distance between the position to be calculated and the nearest sampling point. The maximum value can only be 0.5

According to your table, if you want to calculate the value of 9.7, the coefficient of the c column is wrong. The c corresponding to a=9 is 0.3679, and the c corresponding to a=10 is 0.8584.

The interpolated value at 9.7 is 35.0592

Comments

The result of adding a negative sign in front of delta is correct. "To calculate the value of 9.7, the coefficient of column c is wrong. The c corresponding to a=9 is 0.3679, and the c corresponding to a=10 is 0.8584. The interpolated value at 9.7 is 35.0592." At 9.7, delta is the difference between 9 and 10. The other points in column c should be  Details Published on 2019-8-1 21:27
 
 
 

869

Posts

0

Resources
19
 
Too complicated.
 
 
 

1372

Posts

2

Resources
20
 
littleshrimp posted on 2019-7-31 08:23 I calculated all the points, selected 9.7 for delta, and then summed the data in column d. Theoretically, the result should be between 96 and 19, but the actual result is 0. ...

According to the calculation formula in your Excel spreadsheet, the correct result for delta should be -9.7.

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list