gaussfitn
Version 1.1.2 (3,08 KB) von
Matt J
Fit N-dimensional scattered points with Gaussian+constant
This function uses lsqcurvefit to fit parameters D, A, mu, sig to the R^N-->R
Gaussian+constant model function,
z(x) = D + A*exp( -0.5 * (x-mu).' * inv(sig) *(x-mu) )
Here A and D are unknown scalars, mu is an unknown Nx1 mean vector, and sig is an
unknown NxN covariance matrix. By imposing lower and upper bounds 0<=D<=0 (see below), this can also be used to perform pure Gaussian fitting.
SYNTAX:
[params,resnorm, residual,exitflag,output] = gaussfitn(xdata,zdata,params0,LB,UB,Name,Value)
INPUTS (required):
xdata: MxN matrix whose rows specify M scattered samples in R^N
zdata: Mx1 vector of corresponding samples z(xdata)
INPUTS (optional)
params0: Cell array of initial parameter estimates {D0,A0,mu0,sig0}.
Can also be empty [] in which case default initial guesses
are autogenerated. Can also consist of cell array of empty
and non-empty elements like {D0,[],mu0,[]} in which case
default initial guesses are generated for select parameters.
LB: Cell array of lower bounds {D_LB, A_LB, mu_LB} on D, A, and mu.
UB: Cell array of upper bounds {D_UB, A_UB, mu_UB} on D, A, and mu.
Name,Value: Name/Value option pairs compatible with lsqcurvefit. See,
<https://www.mathworks.com/help/optim/ug/lsqcurvefit.html#buuhcjo-options>.
By default, however, SpecifyConstraintGradient=true unless
over-ridden.
OUTPUTS:
params: Final estimate of the parameters as a cell array {D,A,mu,sig}
resnorm: As in lsqcurvefit
residual: As in lsqcurvefit
exitflag: As in lsqcurvefit
output: As in lsqcurvefit
Zitieren als
Matt J (2024). gaussfitn (https://www.mathworks.com/matlabcentral/fileexchange/69116-gaussfitn), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Erstellt mit
R2018a
Kompatibel mit R2016b und späteren Versionen
Plattform-Kompatibilität
Windows macOS LinuxKategorien
- MATLAB > Mathematics > Numerical Integration and Differential Equations > Ordinary Differential Equations >
Mehr zu Ordinary Differential Equations finden Sie in Help Center und MATLAB Answers
Tags
Quellenangaben
Inspiriert von: 2D Rotated Gaussian Fit, Fit 2D gaussian function to data, Fit 2D Gaussian with Optimization Toolbox, Fit 1D and 2D gaussian to noisy data
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.1.2 | Typo correction |
||
1.1.1 | Small fix to the improved mu0/sig0 estimation method |
||
1.1.0 | Improved initial guesses of mu0 and sig0. |
||
1.0.2 | No change |
||
1.0.1 | Description modification |
||
1.0.0 |