How to find FWHM from this?

206 次查看(过去 30 天)
hnn
hnn 2022-10-8
评论: hnn 2022-10-8
I am very new to Matlab, and am trying to find the FWHM from this curve. I have tried findpeaks, and don't really understand any of it. I have these (time and power) as my variables and have tried but really don't know how to do it.

采纳的回答

Image Analyst
Image Analyst 2022-10-8
See if this is what you want
halfMaxValue = max(power) / 2; % Find the half max value.
% Find indexes of power where the power first and last is above the half max value.
leftIndex = find(power >= halfMaxValue, 1, 'first');
rightIndex = find(power >= halfMaxValue, 1, 'last');
% Compute the delta time value by using those indexes in the time vector.
fwhm = t(rightIndex) - t(leftIndex)

更多回答(1 个)

Chunru
Chunru 2022-10-8
Your data has no half power points so you cannot find fwhm.
load(websave("fwhmdata.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1149260/fwhm%20data.mat"))
whos
Name Size Bytes Class Attributes M 384x2 6144 double cmdout 1x33 66 char data 384x1 3072 double index1 384x1 3072 double index2 384x1 3072 double power 384x1 3072 double time 384x1 3072 double
plot(time, power);
[pmax, imax] = max(power);
hold on
plot(time(imax), pmax, 'ro');
i1 = find(power(imax:-1:1) <= 0.5*pmax, 1, 'first')
i1 = 0×1 empty double column vector
i2 = find(power(imax:end) <= 0.5*pmax, 1, 'first')
i2 = 0×1 empty double column vector
if ~isempty(i1) & ~isempty(i1)
fwhm = tmax(i2+imax-1) - tmin(imax-i1+1);
else
fwhm = nan;
end
fwhm
fwhm = NaN
  8 个评论
hnn
hnn 2022-10-8
Your method did not work but I used a different function which gave me the correct FWHM value which also matches my python answer, as well as matching the physical beam size of the telescope used to gather this data. Thanks for your super super super helpful reply! Have a nice day
Chunru
Chunru 2022-10-8
If you want the width at mid of max and min. Just add:
power = power - min(power);

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by