SST Lab Dokuwiki Header header picture

ユーザ用ツール

サイト用ツール


seminar:plot_curvefit

Curve Fit Inspector

This function allows you to fit data with some predefined functions or free defined functions. Fits are possible with up to 24 functions each with up to 5 free parameters. To start a fit two things are necessary. 1. the function(s) you will fit and 2. the start parameters for the function(s). Fitting will only work if the function you provide will match the data of your buffer otherwise the fit will not succeed and you will see an error message. Fitting work better the closer the start parameters match the data.

The Curve Fit Inspector consists of a few controls and a table for the function and fit parameter definition. Function Table Active functions are displayed with a check mark in the first column. Double clicking the first column changes the state. Function: In this column you have to define the function you want to fit (see below). A, B, C, D, E: This are the free parameters for the fit function. Weight: The weight of a function for the integration routine (only used by the special functions). %: The result of the integration will be displayed in this column (only calculated for the special functions). Controls Narrow/Wide: Change fit table layout to narrow/wide columns. Presets 1-10: Load a stored curve fit preset. Save: Save the current cure fit parameter as one of the 10 possible presets. Preview: Displays all the fit functions and the summary curve in the current document. Clr: Clear the fit preview. Preview Range: Define if the preview should cover the range of your data or the window range. This apply also to export if no export range is defined. Export Fit Data Buffer: Allows to export fit results as new buffers to the document. All: Exports all the fit functions and the summary curve as new buffer to your document. Summary: Exports the summary curve as new buffer to your document. Points, Min, Max: Defines the range and the number of points for curve export. If this fields are empty default values will be used. Iteration Limit: Defines a cycle limit after which it is possible to stop the fit. Values by Mouse: If this button is checked the values from the mouse mode Measure will be sent to the currently selected line in the parameter table (A = X position and B = Y position). After this the next line in the parameter table will selected automatically. This makes it easy to predefine a bunch of peaks. Load: Loads fit data from another document. Back: Every time you start a fit the state will be saved in a history buffer. With this button you can go back trough the fit steps. Start: Starts the fit for the current working buffer. Fit result The text field in the middle of the inspector shows the status and the result of the fit. The first line displays the fit state and the second the fit result: RMSD: Root mean square deviation of the last cycle:

$$ R.M.S.D. =\sqrt{\frac{1}{N}\sum_{i=1}^{N}\left\{y_i-f(x_i)\right\}^2} $$ Chi²: $$\chi^2$$

sigma is the error of your data. If your data set doesn't contain error values Plot makes a statistically approximation of the standard deviation. Function definition In the Function column you can enter normal mathematical expression as functions for fit (there are some special functions, see below). Available variables: x x value A A parameter B B parameter C C parameter D D parameter E E parameter Example: (x+A)^2+B For the 5 fit parameter (A,B,C,D,E) the following syntax is possible: <value> a fixed value <value>~ a value which should be fitted <value>~<dvalue> a value which should be fitted in the range from <value> - <dvalue> to <value> + <dvalue> <row>[+,-,*,/]<rel> sets value in relation to an entry of same column in a previous row Examples: 284 1234~ 10.7~0.2 1-2.3 5*0.12

Plot functions which allow mathematical expressions supports the following functions:

+, -, *, / arithmetic operations

%, mod modulo ( ) grouping

rad(x), deg(x) conversion between radians and degrees sin(x),cos(x),tan(x) trigonometric functions asin(x),acos(x),atan(x) inverse trigonometric functions sinh(x),cosh(x),tanh(x) hyperbolic functions rnd(h) random number (h = height) ln(x),log(x) natural and logarithm to base 10 sqrt(x) square root cbrt(x) cubic root frac(x) returns the fraction of x int(x) returns the integer of x round(x;n) round up and down to the nth place on the right of the decimal point gau(x;x0;a;w) Gauss (x0 = position, a = amplitude, w = width) lor(x;x0;a;w) Lorentz (x0 = position, a = amplitude, w = width) galo(x;x0;a;w;r) Gauss-Lorentz (x0 = position, a = amplitude, w = width, r =Gauss-Lorentz ratio (1.0=pure Gauss,0.0 = pure Lorentz)) tail(x;x0;a;w;r;t) Gauss-Lorentz with exponential Tail (x0 = position, a = amplitude, w = width, r = Gauss-Lorentz ratio(1.0=pure Gauss,0.0 = pure Lorentz)), t = tail exponent factor j0(x), j1(x), jn(x;n) bessel functions y0(x), y1(x), yn(x;n) bessel functions pi 3.14159265359 e 2.71828182846 xval(b;i) x value of point i in buffer b yval(b;i) y value of point i in buffer b xerr(b;i) x error value of point i in buffer b yerr(b;i) y error value of point i in buffer b xnval(b;i) normalized x value (0.0-1.0) of point i in buffer b ynval(b;i) normalized y value (0.0-1.0) of point i in buffer b xnerr(b;i) normalized x error value (0.0-1.0) of point i in buffer b ynerr(b;i) normalized y error value (0.0-1.0) of point i in buffer b xvf(b) x value of the first point in buffer b xvl(b) x value of the last point in buffer b yvf(b) y value of the first point in buffer b yvl(b) y value of the last point in buffer b xmin(b) minimum x value in buffer b xmax(b) maximum x value in buffer b ymin(b) minimum y value in buffer b ymax(b) maximum y value in buffer b exmin(b) minimum x error value in buffer b exmax(b) maximum x error value in buffer b eymin(b) minimum y error value in buffer b eymax(b) maximum y error value in buffer b txmin minimum x value over all buffers txmax maximum x value over all buffers tymin minimum y value over all buffers tymax maximum y value over all buffers vxmin(b) minimum x value over all visible buffer vxmax(b) maximum x value over all visible buffer vymin(b) minimum y value over all visible buffer vymax(b) maximum y value over all visible buffer points(b) number of points in buffer b xpoint(v;a) x screen coordinate of v (a can be 1 for the first or 2 for the second axis). xvalue(v;a) x value of the screen coordinate v (a can be 1 for the first or 2 for the second axis). ypoint(v;a) y screen coordinate of v (a can be 1 for the first or 2 for the second axis). yvalue(v;a) y value of the screen coordinate v (a can be 1 for the first or 2 for the second axis). findx(v;b) x value which depends to y in buffer b. If there are more than one it returns the first it found. findy(v;b) y value which depends to x in buffer b. If there are more than one it returns the first it found. fnx(v;b) normalized x value (0.0-1.0) which depends to y in buffer b. If there are more than one it returns the first it found. fny(v;b) normalized y value (0.0-1.0) which depends to x in buffer b. If there are more than one it returns the first it found.

Special Functions

The fit function supports some special functions. These functions are easy to use and a little bit faster than free defined functions. The special functions can not be used together with other expressions in one row.

GL (Gauss-Lorentz mix curve)

A = position (x0) B = height (I0) C = width ( α, FWHM) D = Gauss-Lorentz ratio ( M ,1.0=pure Gauss, 0.0 = pure Lorentz) E = unused

DS (Doniach-Sunjic curve)

$$ \displaystyle I(E)={\frac {\Gamma (1-\alpha )}{[(E-E_{0})^{2}+\gamma ^{2}]^{(1-\alpha )/2}}}\cos \left\lbrace {\frac {\pi \alpha }{2}}+(1-\alpha )\arctan \left[{\frac {E-E_{0}}{\gamma }}\right]\right\rbrace $$

A position $E_0$
B height $l0$
C width ( γ, Lorentzian FWHM)
D Anderson's exponent ( α, -0.5 … 0.5)
E unused

ET (Gauss-Lorentz mix curve with exponential Tail)

A = position (x0) B = height (I0) C = width ( γ, Lorentzian FWHM) D = Gauss-Lorentz ratio ( M ,1.0=pure Gauss, 0.0 = pure Lorentz) E = tail exponent factor ( α, -infinity - +infinity)

GL* (Gauss convoluted Lorentz curve)

A = position B = height C = width (FWHM) D = Gauss-Lorentz ratio (must be set to 0.0) E = Gauss FWHM (0 - +infinity)

DS* (Gauss convoluted Doniach-Sunjic curve)

A = position B = height C = width (Lorentzian FWHM) D = Anderson's exponent (-0.5 … 0.5) E = Gauss FWHM (0 - +infinity)

seminar/plot_curvefit.txt · 最終更新: 2022/08/23 13:34 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki