フィルターのクリア

identify a corresponding value

5 ビュー (過去 30 日間)
Ahmed Alalawi
Ahmed Alalawi 2020 年 2 月 29 日
コメント済み: Image Analyst 2020 年 2 月 29 日
Hello there,
I have three different signals (1,2,3)
I have identified the peaks values and locations in singal number 1 (blue color).
How can I idenitified the corresponding value of exact location in signals number 2 and 3?
I attached the data and the picture.
Could anyone provide me with the code please?
Thanks
I used this code:
figure (1)
plot (Data (:,1), Data (:,(2)), "b")
hold on
plot (Data (:,1), Data (:,(3)), "g")
hold on
plot (Data (:,1), Data (:,(4)), "r")
hold on
legend({'1','2', '3'},'Location','southwest')
hold on
hold off
[pks,locs] = findpeaks((Data (:,(2))), Data (:,1), 'MinPeakHeight',20, 'MinPeakDistance',1)

採用された回答

Image Analyst
Image Analyst 2020 年 2 月 29 日
Try this:
fullFileName = fullfile(pwd, 'data.mat');
s = load(fullFileName)
Data = s.Data_head;
hFig = figure
plot (Data(:,1), Data (:,2), "b", 'LineWidth', 2)
hold on
plot (Data(:,1), Data (:,3), "g", 'LineWidth', 2)
plot (Data(:,1), Data (:,4), "r", 'LineWidth', 2)
legend({'1','2', '3'},'Location','southwest')
hold off
grid on;
hFig.WindowState = 'maximized'; % Later versions of MATLAB only.
% Data(:, 1) are the x values.
% Get the peaks for y1:
[peakValues1, peakIndexes1] = findpeaks(Data(:,2), 'MinPeakHeight',20, 'MinPeakDistance',3);
% Get the peaks for y2:
[peakValues2, peakIndexes2] = findpeaks(Data(:,3), 'MinPeakDistance',3);
% Get the peaks for y3:
[peakValues3, peakIndexes3] = findpeaks(Data(:,4), 'MinPeakDistance',3);
  2 件のコメント
Ahmed Alalawi
Ahmed Alalawi 2020 年 2 月 29 日
Thanks for the quick response.
What I meant is, based on the peak value in the blue line, I need to identify the corresponing values in the other lines (red and green)? They do not have to be peaks in the red and blue, just the values.
Please see the attached picture for clarification.
Image Analyst
Image Analyst 2020 年 2 月 29 日
You can just use the same indexes you got for the one signal, peakIndexes2, for all other signals. Do this:
% Get the peaks for y2:
peakValues2 = Data(peakIndexes2, 3);
% Get the peaks for y3:
peakValues3 = Data(peakIndexes2, 4);

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

その他の回答 (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