Home > matutils > fwhm.m

fwhm

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

function FWHM = fwhm(x,f)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 A sinple function for determining the full width at half maximum
 Input: 
 x: the array of x-values
 f: the array of function values
 Output:
 fwhm: FWHM of f in the scale given by x
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0002 % A sinple function for determining the full width at half maximum
0003 % Input:
0004 % x: the array of x-values
0005 % f: the array of function values
0006 % Output:
0007 % fwhm: FWHM of f in the scale given by x
0008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0009 function FWHM = fwhm(x,f)
0010 if nargin < 2
0011     f = x;
0012     x=[1:length(f)];
0013 end
0014 f1 = f-0.5*max(f);
0015 ind = find(f1(1:end-1).*f1(2:end) <=0);
0016 FWHM = x(ind(2))-x(ind(1));

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005