Home > Scripts > Models > Factory > ngauss.m

iFit/ngauss

PURPOSE ^

y = ngauss(p, x, [y]) : multiple Gaussians

SYNOPSIS ^

function y=ngauss(varargin)

DESCRIPTION ^

 y = ngauss(p, x, [y]) : multiple Gaussians

   iFunc/ngauss multiple Gaussian fitting function
     y = sum p(i)*exp(-0.5*((x-p(i+1))/p(i+2)).^2) + p(end);

   The HalfWidth parameters are the Gaussian square root variances (Sigma). 
   The 'true' half width are thus 1.177*HalfWidth.

 MODEL CREATION

 You may build a model using any of:
   ngauss('defaults')        builds a 2 Gaussians model
   ngauss(n)                 builds an n Gaussians model
   ngauss and ngauss('gui')  shows a Dialogue to enter the number of Gaussians.
   ngauss([ ... ])           use a 3n+1 values parameters for n Gaussians

 Reference: http://en.wikipedia.org/wiki/Gaussian_function

 MODEL EVALUATION

 input:  p: multiple Gaussian model parameters (double)
            p = [ Amplitude1 Centre1 HalfWidth1 ... BackGround ]
          or 'guess'
         x: axis (double)
         y: when values are given and p='guess', a guess of the parameters is performed (double)
 output: y: model value
 ex:     y=ngauss([1 0 1 0.5 2 0.5 0], -10:10); or plot(ngauss)

 Version: oct.. 23, 2018
 See also iFunc, iFunc/fits, iFunc/plot, nlorz
 (c) E.Farhi, ILL. License: EUPL.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Tue 23-Oct-2018 22:44:35 by m2html © 2005. iFit (c) E.Farhi/ILL EUPL 1.1