How to get the postions of peak on the plot?
2 views (last 30 days)
Show older comments
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?
Answers (1)
Image Analyst
on 12 Jun 2020
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.
0 Comments
See Also
Categories
Find more on Parametric Spectral Estimation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!