use trapz to calculate the peak area
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
Im trying to use the trapz function to calculate the peak area of selected peaks. But it doesn't work and I don't know what is the failure.
My x-axis (mz) is function and my mass spectrometry data (sample) is in a csv-file, it consists of 200 spectras with 17000 data points.
The plot looks fine and all spectras are mapped, but I dont't know how to use the trapz function.
1) Is trapz the correct function for my problem? 2) How can I integrate only in a small area around the peak (from a to b)? 3) How can I calculate the area between a baseline and a peak?
Im a bit frustrated because I can't find a solution in the forum or on mathworks.com! :-(
mz: 17000x1 double
sample: 17000x200 double
if true
% code
sample = importdata('Daten.csv');
x = [0.0005:0.0005:8.5];
t = x.';
clear x;
mz = (2.5347*(t-0.169).^2);
clear t;
figure(1) plot(mz, sample(:,:)) grid
xlabel('Masse/Ladung (m/z)'); ylabel('Intensität'); title('Massenspektren');
a = 27.5; b = 28,5; c = 0.095
area_1 = trapz(mz, sample(:,1)); ???
end
Thx for your help!
Kind regards Paul
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differentiation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!