File Exchange

image thumbnail

fwhm

version 1.0.0.0 (1.49 KB) by Patrick Egan
To calculate the full-width at half-maximum of an input.

103 Downloads

Updated 05 Apr 2006

View License

width = fwhm(x,y)

Full-Width at Half-Maximum (FWHM) of the waveform y(x) and its polarity.

The FWHM result in 'width' will be in units of 'x'

The code was developed by an unknown author.

Cite As

Patrick Egan (2021). fwhm (https://www.mathworks.com/matlabcentral/fileexchange/10590-fwhm), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (63)

Andrea Vettiger

Fabian Sarango

I am trying to understand some parts of the code, please could anyone provide me with some guidance? Many thanks

mohd akmal masud

how to run?

xin li

Nice work.

Walker

Thanks @Brandon Nichols. I update it in lines 12 and 14. Then the codes works well.
y = y - min(y); %need to subtract off minimum to span [0 1]
i = 2;
while (sign(y(i)-lev50) == sign(y(i-1)-lev50) && (i <= N-1))

maciej kowalczyk

Rajanikant Panda

Manoj Wijesooriya

it work perfectly and accurately, Thank you

Mariya Maleyko

Hi, i have a problem using your function, Could you tell me please if i am doing anything wrong.
Index in position 1 exceeds array bounds (must not exceed 1).
width = fwhm([1,2,3,4,5,6,7,8], [2,4,5,6,8,5,3,2]);

Ni Phan

Thank you, it's simply perfect.

wenqian zhang

hung-yu she

It works thank you

S P-W

So helpful. but I have a question! this code can be used for all the data?for all pulses shapes? anyone any experiences?

Nima Soltani

pz Dang

Lifeng Gan

Amit Kaplan

Sulaiman Khan

lemon

jiahao liu

Thanks o(≧v≦)o

Anu D

Valeriya Perekatova

Geoffrey Chase

Nikita Vasilev

Hsu-Cheng Cheng

useful, thx!

riad didou

hii
i have 5 pulse in my signal ...how to find FWHM for every pulse?

Thanks in advance

Kirk Truax

Paul Bebb

is there a reason why the widths come out negative?

418

Vasanth

Can this be extended to find out FWHM of multiple culrves in a single plot and compare between the FWHM? If so, how?

this code is not working for raised sine and raise cosine functions.

Brandon Nichols

Add the following line to handle data with a narrow dynamic range (insert at line 12).

y = y - min(y); %need to subtract off minimum to span [0 1]

BNeto

Great! Quite happy with it.

Rick Hsieh

cai jason

THANKS TO SHARING

Matthew Lee

When I try to take columns out of my array into fwhm - e.g. fwhm(peak(:,1),peak(:,2)) - I am getting an error saying that max is undefined for 'datasets'. So there is an error in y = y / max(y).

Sorry, I have no experience with MatLab. Any help would be greatly appreciated!

Parimalah Velo

Thank you for sharing :)

Benjamin Ficara

I'm trying to use this on spectral data from FTIR and I'm getting the error " Attempted to access y(132); index out of bounds because numel(y)=131."

My data is 131 points. Can anyone help me figure out how to use this? I'm very inexperienced with Matlab

Rafael Ribeiro

Ilias Giannakopoulos

Thanks man :)

Joao

so good

Subhajit

thanks a lot. Finally I have got the result.

Bob

Works as advertised, a great improvement over the simple algorithm for FWHM I was using.

Jade He

Thank you.

Eric

wow
the code is perfect, thanks a lot

Bakhtiyar Orazbayev

Mikhail Konnik

yongbiao shi

thanks

Nicolas

Brilliant, saved me a lot of time!

Robert

Donald

Simple and easy to read. I modified it to search for the falling edge from the end of the array instead of from the peak because my pulses have high overshoot at the rising/falling edges.

Tom Phillips

Thanks

Amr Sadek

very easy to use, thank you

Brian

Need to add y=y-min(x) at beginning to find fwhm of data not going to zero

Nathir Rawashdeh

It does not work for noisy y(x). It keeps saying the peak is an impulse.

John Smith

Superb

bioguider bioguider

easy to use

Ketki V

Fantastic! Im so glad I found this!

Rajiv Bharadwaj

Great Job !

Sue S

Very easy to use!

Igor K

great job!

zm o

This file's suitable to use for experimental datas.

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!