identify a corresponding value
조회 수: 2 (최근 30일)
이전 댓글 표시
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)
댓글 수: 0
채택된 답변
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
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 Exchange에서 Measurements and Feature Extraction에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!