how to find time corresponds to peak of plot?

2 ビュー (過去 30 日間)
majid
majid 2021 年 11 月 30 日
コメント済み: majid 2021 年 11 月 30 日
Hello to everyone.
I have a signal which it is photoelectron vs. Time, I want to interpolate it with factor of 4, so I did it and derived photoelectron vs. sample. Then, I want to limit this signal just 240 sample to the right and 240 sample to the left. Now I want to know at which time I have peak? Can anyone help me? What should I do with time vector to achieve this?
Here is my codes and data of signal and time are also attached:
%% interpolation
N_interpolation=4;
signal_padd_zero=zeros(1,N_interpolation*length(lowpass_signal));
signal_padd_zero([1:N_interpolation:end])=lowpass_signal;
interpolated_signal=lowpass(signal_padd_zero,0.01);
plot(interpolated_signal, 'b.-')
axis tight
xlabel('samples')
ylabel('photoelectron')
title('interpolated signal')
%% Limited signal
% max sample
[~,index_of_interpolated_signal]=max(interpolated_signal);
sprintf('Maximum of N occurred at index position %d.',...
index_of_interpolated_signal)
% range of samples for processing
% we limit the signal in order to reduce the computation time
x1=index_of_interpolated_signal-(60*N_interpolation);
x2=index_of_interpolated_signal+(60*N_interpolation);
interpolated_signal=interpolated_signal(x1:x2);
figure;plot(interpolated_signal, 'b.-')
axis tight
xlabel('samples')
ylabel('photoelectron')
title('limited signal')
%% now how can I find the time that corresponds to the peak?
  1 件のコメント
majid
majid 2021 年 11 月 30 日
because I interpolate then limit the signal and also I plot the signal photoelectron vs. sample , I dont hve any idea abot time!

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

回答 (1 件)

KSSV
KSSV 2021 年 11 月 30 日
If (t,x) is your time and respective data.
[val,idx] = max(x) ;
t_maxx = t(idx)
  3 件のコメント
KSSV
KSSV 2021 年 11 月 30 日
編集済み: KSSV 2021 年 11 月 30 日
load('time.mat')
load('signal.mat')
[val,idx] = max(lowpass_signal) ;
t_maxx = t(idx) ;
plot(t,lowpass_signal)
hold on
plot(t_maxx,val,'*r')
majid
majid 2021 年 11 月 30 日
I want to find peak at the interpolated_signal plot, not lowpassed signal!
this-> interpolated_signal=interpolated_signal(x1:x2);

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

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by