# Fit on subdomain - Graphics

This is a discussion on Fit on subdomain - Graphics ; is it possible to use the &lt;fit&gt; command in gnuplot, asking for it to find values just on a subdomain? E.G. I need to fit f(x)=atan(10-a*x) to my data, but I ask that a&gt;0 Thanks for any help! Alessandro Magni...

1. ## Fit on subdomain

is it possible to use the <fit> command in gnuplot, asking for it to
find values just on a subdomain?
E.G. I need to fit f(x)=atan(10-a*x) to my data, but I ask that a>0

Thanks for any help!

Alessandro Magni

2. ## Re: Fit on subdomain

On Tue, 13 Nov 2007, alexxx.magni@gmail.com wrote:

> is it possible to use the <fit> command in gnuplot, asking for it to
> find values just on a subdomain?
> E.G. I need to fit f(x)=atan(10-a*x) to my data, but I ask that a>0

Unless you really need to preserve the shape of the chi-squared
function, you could try:

f(x) = atan(10.0-b**2.0*x)
b = someinitialguess
fit f(x) "data.dat" using (somecolumn)someothercolumn) via b
a = b**2.0

--

HTH,

Dan Hatton

<http://www.bib.hatton.btinternet.co.uk/dan/>

3. ## Re: Fit on subdomain

alexxx.magni@gmail.com wrote:
> is it possible to use the <fit> command in gnuplot, asking for it to
> find values just on a subdomain?
> E.G. I need to fit f(x)=atan(10-a*x) to my data, but I ask that a>0

The usual technique is to make the restricted parameter a function of
the real, fitted parameter, e.g.

fit atan(10-exp(a)*x) 'data' via a

print 'actual result is ', exp(a)