Time of Flight measurement
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/288555/image.png)
0 Kommentare
Antworten (2)
darova
am 29 Apr. 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','*')
Bjorn Gustavsson
am 29 Apr. 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 Kommentare
Bjorn Gustavsson
am 4 Mai 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.
Siehe auch
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!