I have 2 columns, i want to find the maximum in the second column and then know what value it is next to on the first column
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello. I have two columns that are 1221 rows long. The absorbance is on the first column and the wavelength on the second column. I want to find the maximum value for wavelength between 651:1221. Then i want to know the value of the absorbance next to it. When i know the value of that absorbance i need the absolute value of that absorbance subtracted by 520. How do I do this? Thanks for your help!
0 comentarios
Respuestas (2)
Kevin Holly
el 22 de Mzo. de 2023
Editada: Kevin Holly
el 22 de Mzo. de 2023
Generate data
M = rand(1221,2)*1000;
Find max value and it's index in rows 651 to 1221 in the 2nd column of M.
[maxvalue, index] = max(M(651:1221,2))
Look at the first column value at that specific row. Then take the absolute value and subtract 520.
Answer = abs(M(index+650,1))-520
5 comentarios
Kevin Holly
el 22 de Mzo. de 2023
Generate data
M = rand(1221,2)*1000;
Did you want to normalize based on the absorbance at the max wavelength?
Find max value and it's index in rows 651 to 1221 in the 2nd column of M.
[maxvalue, index] = max(M(651:1221,2))
absorbance_at_max_wavelength = M(index+650,1)
norm_absorbance = M(:,1)/absorbance_at_max_wavelength;
Look at the first column value at that specific row. Then take the absolute value and subtract 520.
Answer = abs(norm_absorbance(index+650,1))-520
Or did you want to normalize based on the max absorbance?
M(:,1) = M(:,1)/max(M(:,1))
Answer = abs(M(index+650,1))-520
the cyclist
el 22 de Mzo. de 2023
% Pretend data
aw = rand(1221,2) + 250;
% Max 2nd col in range, with index
[maxW,idx] = max(aw(651:1221,2));
% Absorbance for that value of W
aAtMaxW = aw(650+idx,1);
% Subtract 520 and take absolute value
a520 = abs(aAtMaxW - 520)
4 comentarios
the cyclist
el 22 de Mzo. de 2023
I'm not sure what "redo the data to have the new absorbance" means. Do you want to divide all the absorbance values by this value we helped you calculate? If so, then
data(:,1) = data(:,1)/peak_520
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!