Assuming you can find the indices of your ranges by some means, e.g. findpeaks, then make an array of the ranges, for example
ranges = [103 128;
182 196;
297 315]
then loop through the ranges using the trapezoidal rule for example
numRanges = size(ranges,1)
F = zeros(numRanges,1);
for k = 1:size(ranges,1)
F(k) = trapz(Y(ranges(k,:)))
end
2 件のコメント
darova (view profile)
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/486699-integration-via-trapezoidal-rule-in-various-sections-of-the-same-array#comment_758973
FW (view profile)
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/486699-integration-via-trapezoidal-rule-in-various-sections-of-the-same-array#comment_759044
サインイン to comment.