How to find FWHM from this?

209 ビュー (過去 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 件のコメント
hnn
hnn 2022 年 10 月 8 日
Awesome thank you! That gave me exactly what I needed

サインインしてコメントする。

その他の回答 (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 Center および File ExchangeStructures についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by