function [FWHM] = getFWHM(signal,t_int)

% function [FWHM] = getFWHM(signal, t_int)
%
% This function takes a signal vector and time interval between each data
% points, and generates a Full Width Half Max (FWHM).
%
% Input parameters:
% signal: a vector containing the function data points.
% t_int : a scalar time interval between each data points.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Current state of the project and change history.
%
%	Created by:	M. Wetstein
%	Created on:	Unknown
%
%	Version: 1.1
%	Modified by: R. Obaid
%	Edited on:	07/08/2011
%	  (a)	Building it as function primitives
%
% If you type 'help FWHM' on the Matlab command window, you will be
% able to see the help documentation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% beginning of code %%%%%%%%%%%%%%%%%%%%%%%


if nargin <2
    error('There must be two inputs:1)Signal vector 2)Time interval')
end


high = signal > .5*max(signal);

count=sum(high);

FWHM = count*t_int;