How can I plot 2 data in 1 graph and find common peak
이전 댓글 표시
How can I plot 2 data in 1 graph and find common peak
Common peak is a peak that appear at the same X coordinate but have different Y value
pure_brain = readmatrix('Pure Brain Spectra.csv');
[pks,locs] = findpeaks(pure_brain(:,2));
x = 1:size(pure_brain,1);
Y = pure_brain(locs(Lv),2);
Y = Y .* 100/max(Y);
[pks_min,pks_max] = bounds(pks) % Minimum & Maximum Values Of ‘pks’
figure
Lv = pure_brain(locs,2)>1E+4; % Set Threshold = 1E+4
% Lv = pure_brain(locs,2)>1; % Set Threshold = 1
%plot(x(locs(Lv)), pure_brain(locs(Lv),2), '.r')
plot(x(locs(Lv)), Y, '.r')
grid
title('Pure brain peak');
%AB=unique(pks);
%YB1=AB(end); %1Y
%YB2=AB(end-1); %2Y
%YB3=AB(end-2); %3Y
%EB1=find(pks==YB1);
%XB1=locs(EB1);
%EB2=find(pks==YB2);
%XB2=locs(EB2);
%EB3=find(pks==YB3);
%XB3=locs(EB3);
%SYB = [ YB1 YB2 YB3 ];
%SXB = [ XB1 XB2 XB3 ];
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!