use trapz to calculate the peak area

6 次查看(过去 30 天)
Paul
Paul 2015-1-9
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 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by