1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
function [f] = fwhm(y, varargin)
//This function computes peak full width at half minimum or at another level of peak minimum for vector or matrix data y supplied as input.
//Calling Sequence
//f = fwhm (y)
//f = fwhm (x, y)
//f = fwhm (…, "zero")
//f = fwhm (…, "min")
//f = fwhm (…, "alevel", level)
//f = fwhm (…, "rlevel", level)
//Parameters
//y: vector or matrix
//Description
//This is an Octave function.
//This function computes peak full width at half minimum or at another level of peak minimum for vector or matrix data y supplied as input.
//If y is a matrix, fwhm is calculated for each column as a row vector.
//The second argument is by default "zero" which computes the fwhm at half maximum. If it is "min", fwhm is computed at middle curve.
//The option "rlevel" computes full-width at the given relative level of peak profile.
//The option "alevel" computes full-width at the given absolute level of y.
//This function returns 0 if FWHM does not exist.
//Examples
//fwhm([1,2,3;9,-7,0.6],[4,5,6])
//ans = 0.
funcprot(0);
rhs = argn(2)
if(rhs<1 | rhs>5)
error("Wrong number of input arguments.")
end
select(rhs)
case 1 then
f = callOctave("fwhm",y)
case 2 then
f = callOctave("fwhm",y,varargin(1))
case 3 then
f = callOctave("fwhm",y,varargin(1),varargin(2))
case 4 then
f = callOctave("fwhm",y,varargin(1),varargin(2),varargin(3))
case 5 then
f = callOctave("fwhm",y,varargin(1),varargin(2),varargin(3),varargin(4))
end
endfunction
|