Borrar filtros
Borrar filtros

Time of Flight measurement

4 visualizaciones (últimos 30 días)
Taher Sahara
Taher Sahara el 29 de Abr. de 2020
Comentada: Bjorn Gustavsson el 4 de Mayo de 2020
I have a time domain signal and i want to calculate the time of flight for in general any such signals.
For that my code should detect the point of maxima(along with its time of occurence) of the first wave packet as marked in the image and the second point of maxima (along with its time of occurence). So after knowing the time of occurence of both peaks, time of flight can be calculated easily by calculating their difference.
This is easily done manually but how it can be done with the help of code?
Please help.

Respuestas (2)

darova
darova el 29 de Abr. de 2020
Try this trick
p = [0.0772 0.7149
0.1256 0.7588
0.1878 0.8231
0.2431 0.7646
0.2869 0.3114
0.3836 0.3202
0.4597 0.3173
0.5541 0.3348
0.6187 0.3260
0.6855 0.3231
0.7339 0.4284
0.7800 0.3845
0.7984 0.4839
0.8353 0.3874
0.8813 0.3845
0.9320 0.3465
0.9850 0.3377];
x = p(:,1);
y = p(:,2);
plot(x,y)
[~,ix1] = max(y); % calculate max
[~,ix2] = max(y(10:end)); % calculate max in second half of the data
ix2 = 9+ix2;
line(x(ix1),y(ix1),'marker','*')
line(x(ix2),y(ix2),'marker','*')
  1 comentario
Taher Sahara
Taher Sahara el 30 de Abr. de 2020
This wont work everytime as the wave packet's time may vary so everytime i have to set the range for second maximum. I want to make a generalized code which will work for all signals. The code itself must consider the range after first wave packet diminishes.

Iniciar sesión para comentar.


Bjorn Gustavsson
Bjorn Gustavsson el 29 de Abr. de 2020
You might get somewhere by calculating the spectrogram (short-time FT) of your signal. That might allow you to identify the time for peaks of the spectral power (possibly above some cut-off-frequency?). Have a look at spectrogram.
HTH
  7 comentarios
Taher Sahara
Taher Sahara el 4 de Mayo de 2020
Editada: Taher Sahara el 4 de Mayo de 2020
Thanks for the reply, ill try conv function to create an envelope and then extract the required data.
Max function works fine when i know the range, in my case the time of arrival of wave packets may vary so every time a given range may not work. That is why im looking for an alternative.
Bjorn Gustavsson
Bjorn Gustavsson el 4 de Mayo de 2020
But you only need to exclude the first pulse, right? The rest is signal of your interest, right? If that's the case you only need to exclude the first pulse and then the rest is where you should look for maxima. You could also simply look for local maxima, i.e. points where S(idx)-S(idx-1)>0 and S(idx+1)-S(idx)<0. You can get every such local maxima rather efficiently with diff. There might also be a file-exchange submission doing this.

Iniciar sesión para comentar.

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by