Peaklorentzian: Difference between revisions
Jump to navigation
Jump to search
imported>Jeremy (Importing text file) |
|||
(One intermediate revision by one other user not shown) | |||
Line 12: | Line 12: | ||
Given a 3-element vector of parameters (x) and a vector of independent variables e.g. a wavelength or frequency axis (ax), PEAKLORENTZIAN outputs a Lorentzian peak (y). If more than one output is requested, it also outputs the Jacobian (y1) and Hessian (y2). Derivatives are with respect to the parameters and are evaluated at (x). This function is called by PEAKFUNCTION. | Given a 3-element vector of parameters (x) and a vector of independent variables e.g. a wavelength or frequency axis (ax), PEAKLORENTZIAN outputs a Lorentzian peak (y). If more than one output is requested, it also outputs the Jacobian (y1) and Hessian (y2). Derivatives are with respect to the parameters and are evaluated at (x). This function is called by PEAKFUNCTION. | ||
==== | ====Inputs==== | ||
* '''x''' = 3 element vector with parameters | * '''x''' = 3 element vector with parameters | ||
Line 24: | Line 24: | ||
* '''ax''' = vector of independent variables e.g. a wavelength or frequency axis with elements , . | * '''ax''' = vector of independent variables e.g. a wavelength or frequency axis with elements , . | ||
==== | ====Outputs==== | ||
* '''y''' = vector with the Lorentzian function, . | * '''y''' = vector with the Lorentzian function, . | ||
Line 35: | Line 35: | ||
The function is | The function is | ||
:y = x(1)*1./(1 + ((p-x(2))/x(3)).^2 ); %1xN. | |||
===Examples=== | ===Examples=== |
Latest revision as of 09:31, 23 May 2023
Purpose
Outputs a Lorentzian function, Jacobian, and Hessian for a given set of input parameters and axis.
Synopsis
- [y,y1,y2] = peaklorentzian(x,ax)
Description
Given a 3-element vector of parameters (x) and a vector of independent variables e.g. a wavelength or frequency axis (ax), PEAKLORENTZIAN outputs a Lorentzian peak (y). If more than one output is requested, it also outputs the Jacobian (y1) and Hessian (y2). Derivatives are with respect to the parameters and are evaluated at (x). This function is called by PEAKFUNCTION.
Inputs
- x = 3 element vector with parameters
- x(1) = coefficient ,
- x(2) = mean , and
- x(3) = spread .
- ax = vector of independent variables e.g. a wavelength or frequency axis with elements , .
Outputs
- y = vector with the Lorentzian function, .
- y1 = matrix of the Jacobian of evaluated at (x).
- y2 = matrix of the Hessian of evaluated at (x).
Algorithm
The function is
- y = x(1)*1./(1 + ((p-x(2))/x(3)).^2 ); %1xN.
Examples
- %Make a single known peak
- ax = 0:0.1:100;
- y = peaklorentzian([2 51 8],ax);
- plot(ax,y)
See Also
peakfunction, peakgaussian, peakpvoigt1, peakpvoigt2, peakstruct