smpl.plot.fit
- smpl.plot.fit(func, *adata, **kwargs)[source]
Fit and plot function to datax and datay.
Parameters
- dataxarray_like
X data either as
unp.uarray
ornp.array
orlist
- datayarray_like
Y data either as
unp.uarray
ornp.array
orlist
- functionfunc
Fit function with parameters:
x
,params
- **kwargsoptional
see
plot_kwargs()
.
Fit parameters can be fixed via
kwargs
eg.a=5
.Returns
- array_like
Optimized fit parameters of
function
todatax
anddatay
. Ifdatay
is complex, both the real and imaginary part are returned.
Examples
>>> from smpl import functions as f >>> from smpl import plot >>> param = plot.fit([0,1,2],[0,1,2],f.line) >>> plot.unv(param).round()[0] 1.0
(
Source code
,png
,hires.png
,pdf
)