Plotting specific range - amplitude peak

4 ビュー (過去 30 日間)
Kaique Silva
Kaique Silva 2015 年 6 月 19 日
コメント済み: Star Strider 2015 年 6 月 28 日
Hi, I have this data, and what I am trying to do is plot just the first peak (shown inside the rectangle) of the amplitude plot. I work with different data, so I am looking for a way to do it automatically. Any ideas?
It is more like 'giving a zoom' in that specific range. I am using the following the code to plot the data.
format long g
fid2 = fopen('FarReceiver.csv');
if fid2 > 0
data = textscan(fid2,'%s %s %f %f %f','Delimiter',',','HeaderLines',1);
fclose(fid2);
end
Timestamp2 = strcat(data{:,2});
Timeformat2=datenum(Timestamp2,'HH:MM:SS.FFF');
ConvertTime2 = (Timeformat2 * 86400000);
b = ConvertTime2(1);
TimestampNum2 = (ConvertTime2 - b);
amplitude2 = [data{:,5}]';
Amplitude_max2 = max(abs(amplitude2));
ampfar = (amplitude2/Amplitude_max2);
z = mean(ampfar);
amp2 = (ampfar - z);
plot(TimestampNum2, amp2)
Thank you very much!

採用された回答

Star Strider
Star Strider 2015 年 6 月 19 日
If you have the Signal Processing Toolbox, use the findpeaks function.
This is written to be specific to the data you attached, so I don’t know how well it would generalise to your other signals. It is a way to automate your isolation of the first impulse.
This replaces your plot call in your code:
[Pks,Locs] = findpeaks(amp2, 'MinPeakHeight',0.2, 'MinPeakDistance',50);
figure(1)
plot(TimestampNum2, amp2)
hold on
plot(TimestampNum2(Locs(1)), Pks(1), '^r')
hold off
figure(2)
plot(TimestampNum2(Locs(1)-5:Locs(2)-5), amp2(Locs(1)-5:Locs(2)-5))
grid
You may need to experiment with it to get the result you want.
  4 件のコメント
Kaique Silva
Kaique Silva 2015 年 6 月 28 日
Thank you very much. Have a good day!
Star Strider
Star Strider 2015 年 6 月 28 日
As always, my pleasure.
You, too!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by