Re: Limits to a fitting curve



Stefan Brinker schrieb:
Christoph Bersch schrieb:
Stefan Brinker schrieb:
with the fitting, done like this:
f(x)=a*x**3+b*x**2+c*x+d
a=1; b=1; c=1; d=1
fit f(x) 'test1.DAT' using 1:2 via a,b,c,d
plot [600:1000] 'test1.DAT' using 1:2 title 2, f(x)

Is it possible to set limits to the x-values of the fitting curve? I don´t need the curve to cover the whole 600-1000, only the area of the measured data (630-900) should be covered.
Just change your plot command to
plot [630:900] ...

Christoph

Sadly this is not possible because there are other measuring curves which cover the area of 600:1000 and all graphs have to be from 600 to 1000, so they are comparable.

Ok, now I know what the problem is.

You can do it like this:

f(x)=a*x**3+b*x**2+c*x+d
a=1; b=1; c=1; d=1
fit f(x) 'test1.DAT' using 1:2 via a,b,c,d
F(x) = (x < 630 || x > 900) ? NaN : f(x)
plot [600:1000] 'test1.DAT' using 1:2 title 2, F(x)

However, I don't know if this is the most elegant way.

Isn´t it possible to cut off the fitting curve at some value?

I don't know if it would make sense (and if its possible) to allow a range specification for every function that is plotted and then take the range that includes all 'subranges' to plot the functions:

plot [0:10] f(x), [-2:8] g(x)

gives a plot for [-2:10]

Christoph
.



Relevant Pages

  • Re: identify separate weighted probability plots
    ... Anyway, the probability plot is bi-modal and I would like to fit separate weighted curves to the peaks, plot, and have some sort of confidence number plotted and displayed. ... I believe you want to treat this as a distribution fitting problem instead of creating a histogram and fitting a curve to the bar heights. ...
    (comp.soft-sys.matlab)
  • Re: Fitting Data
    ... to plot this data and plot a line of best fit through it! ... My curve starts off with a curving section upwards, ... After that, you would have to fit the two sections, compute the overall residual, and move the breakpoint one direction or the other and repeat until you locate a minimum. ... A common-enough problem that might have some code at the Code Exchange, ...
    (comp.soft-sys.matlab)
  • Re: Curve fit to 3D data
    ... "Thomas " wrote in message ... My objective is to find a best fit curve to match the points in my matrix and then plot the points using scatter3 and the fit curve in one plot. ...
    (comp.soft-sys.matlab)
  • Re: Curve fit to 3D data
    ... "Thomas " wrote in message ... > My objective is to find a best fit curve to match the> points in my matrix and then plot the points using scatter3 and the fit> curve in one plot. ...
    (comp.soft-sys.matlab)
  • Re: Least Square fitting
    ... I plot ... the data and fit a "rough" curve to it and found that the intercept of ...
    (sci.math)