How to get the postions of peak on the plot?

2 次查看(过去 30 天)
Hello everyone, i maked a program that a use this files:
the program is:
function [names,tr,X] = dadoshplc(r1,r2)
% Esta função importa os cromatogramas do HPLC
% Importar usando r1=1597 e r2=3156
[names, path] = uigetfile({'*.txt','datefiles(.txt)'},'MultiSelect','on','SelectFiles..');
% Abre uma janela para selecionar os arquivos
cd(path); % Indica o caminho a ser selecionado e traz para o current folder
if ischar(names) == 1 % Se for importado apenas um arquivo
num = 1;
else
num = length(names); % Se for importado mais de um arquivo
end
for i = 1:num
if num <= 1
files = names; % Se for importado apenas um arquivo
else
files = names{i}; % Se for importado mais de um arquivo
end
tr = dlmread(files,'\t', [r1 0 r2 0]); % Importa o eixo das variáveis: tempo de retenção.
x = dlmread(files,'\t',[r1 1 r2 1]); % Importa as intensidades.
X(:,i) = x(:,1);
% Etapa de plotagem
subplot(1,2,1)
plot(tr,x) % plot de um cromatograma
axis tight
xlabel('tr/min')
ylabel('mV')
subplot(1,2,2)
plot(tr,X) % plot de todos os cromatogramas
axis tight
xlabel('tr/min')
ylabel('mV')
pause(0.5);
legend('Aguarde')
%legend('click Aqui')
%keydown = waitforbuttonpress;
close all
end
X = X';
close all
figure
plot(tr,X)
axis tight
xlabel('tr/min')
ylabel('mV')
end
and the output is:
I wanna create a program that get the positions these 5 peaks on the grafic. for example, in this program the position is:
pico1 = 780:870;
pico2 = 910:1020;
pico3 = 1130:1220;
pico4 = 1221:1330;
pico5 = 1331:1500;
Someone can help me?
  3 个评论
Rodrigo Franco
Rodrigo Franco 2020-6-11
thanks man, but i dont know how to get only these 5 peaks
when i use findpeaks(a(:, 2)) for exemple and the output is:
and i dont know whats means this parameter 2 findpeaks(a(:, 2))

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2020-6-12
Attach your file(s) here, with the paper clip icon, not in Google (we're not going to go there), if you need more help.
When you say a(:, 2), it means you're extracting the second column only - that's just super basic MATLAB indexing.
You might be interested in my attached demo that fits a specified number of Gaussians to a signal.

类别

Help CenterFile Exchange 中查找有关 Parametric Spectral Estimation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by