Peakgaussian: Difference between revisions
Jump to navigation
Jump to search
imported>Jeremy (Importing text file) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
===Purpose=== | ===Purpose=== | ||
Outputs a Gaussian function, Jacobian, and Hessian for a given set of input parameters and axis. | Outputs a Gaussian function, Jacobian, and Hessian for a given set of input parameters and axis. | ||
===Synopsis=== | ===Synopsis=== | ||
: [y,y1,y2] = peakgaussian(x,ax) | : [y,y1,y2] = peakgaussian(x,ax) | ||
===Description=== | ===Description=== | ||
Given a 3-element vector of parameters (x) and a vector of independent variables e.g. a wavelength or frequency axis (ax), PEAKGAUSSIAN outputs a Gaussian 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), PEAKGAUSSIAN outputs a Gaussian 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 | ||
* '''x(1)''' = coefficient , | * '''x(1)''' = coefficient , | ||
* '''x(2)''' = mean , and | * '''x(2)''' = mean , and | ||
* '''x(3)''' = spread . | * '''x(3)''' = spread . | ||
* '''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 Gaussian function, . | * '''y''' = vector with the Gaussian function, . | ||
* '''y1''' = matrix of the Jacobian of evaluated at (x). | * '''y1''' = matrix of the Jacobian of evaluated at (x). | ||
* '''y2''' = matrix of the Hessian of evaluated at (x). | * '''y2''' = matrix of the Hessian of evaluated at (x). | ||
===Algorithm=== | ===Algorithm=== | ||
The function is | The function is | ||
* '''y(1) ''' = <math> {{x}_{1}}{{\operatorname{e}}^{\!{-({{p-{x}_{2}})^{2}}\over\!2{{x}_{3}}^{2}}}}</math> , 1xN | |||
* '''y(2) ''' = <math>{\operatorname{d}\!y\over\operatorname{d}\!{x}_{i}}</math> , 3xN | |||
* ''' y(3) ''' = <math>{\operatorname{d^2}\!y\over\operatorname{d}\!{{x}_{i}}^{2}}</math> , 3x3xN | |||
===Examples=== | ===Examples=== | ||
:%Make a single known peak | :%Make a single known peak | ||
: ax = 0:0.1:100; | : ax = 0:0.1:100; | ||
: y = peakgaussian([2 51 8],ax); | : y = peakgaussian([2 51 8],ax); | ||
: plot(ax,y) | : plot(ax,y) | ||
===See Also=== | ===See Also=== | ||
[[peakfunction]], [[peaklorentzian]], [[peakpvoigt1]], [[peakpvoigt2]], [[peakstruct]] | |||
[[peakfunction]], [[peakexponential]], [[peaklorentzian]], [[peaksigmoid]], [[peakpvoigt1]], [[peakpvoigt2]], [[peakstruct]] |
Latest revision as of 09:29, 23 May 2023
Purpose
Outputs a Gaussian function, Jacobian, and Hessian for a given set of input parameters and axis.
Synopsis
- [y,y1,y2] = peakgaussian(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), PEAKGAUSSIAN outputs a Gaussian 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 Gaussian function, .
- y1 = matrix of the Jacobian of evaluated at (x).
- y2 = matrix of the Hessian of evaluated at (x).
Algorithm
The function is
- y(1) = , 1xN
- y(2) = , 3xN
- y(3) = , 3x3xN
Examples
- %Make a single known peak
- ax = 0:0.1:100;
- y = peakgaussian([2 51 8],ax);
- plot(ax,y)
See Also
peakfunction, peakexponential, peaklorentzian, peaksigmoid, peakpvoigt1, peakpvoigt2, peakstruct