Finding the full width half maximum (FWHM) of a rounded part of peak instead of sharp peaks

조회 수: 18 (최근 30일)
Hi, I have this plot where I want to find the FWHM around the main "bulge" of the plot (around the red line I have crudely drawn), ignoring the other sharper peaks. I have attached a file of the XY coordinates and would appreciate any help! Many thanks

채택된 답변

Adam Danz
Adam Danz 2021년 11월 18일
편집: Adam Danz 2021년 11월 18일
This uses rmoutliers to remove the spike and then computes the FWHM of the resultant curve. You can play around with rmoutliers to get the expected curve or use a different method if you find something more suitable.
Other approaces:
  • fit the curve to a gaussian and use the fit parameters to compute FWHM.
  • Use findpeaks along with the half-height width reference. See demo.
data = load('FWHM_Help_Plot_Data.mat');
% Plot raw data
h(1) = plot(data.X, data.Z, 'DisplayName', 'RawData');
hold on
% Remove outliers
[Zm,idx] = rmoutliers(data.Z, 'movmedian', 300);
h(2) = plot(data.X(~idx), Zm, 'DisplayName', 'rmOutlier');
% Compute FWHM
halfMax = max(Zm)/2; % simple since the baseline is near 0
lrIdx = [find(Zm >= halfMax, 1, 'first'), find(Zm >= halfMax, 1, 'last')]; % L/R index of width
fwhm = diff(data.X(lrIdx));
% Show bounds
h(3) = yline(halfMax, 'k--', 'DisplayName', 'HalfHeight');
h(4) = xline(data.X(lrIdx(1)), 'DisplayName', 'WidthBounds');
xline(data.X(lrIdx(2)));
legend(h)
title(sprintf('FWHM = %g', fwhm))
  댓글 수: 2
Manny Kins
Manny Kins 2021년 11월 18일
Many thanks Adam Danz, this is working very well for me, I played around with rmoutliers and set the value to 400 and got some really nice results! thanks again

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by