5

what i do is to fit two linear function´s to my data. i know how to select the data for the various fitting functions. My problem is that i want the fitted lines only to be plottet in a certain interval. What i did till now:

f(x) = a*x + b; fit [800:1250][-2:8] f(x) 'Daten.txt' u 1:2 via a,b   

g(x) = c*x + d; fit [1258:1650][-2:8] g(x) 'Daten.txt' u 1:2 via c,d                                                                            

plot "Daten.txt" u 1:2 w l, f(x) t title_f(a,b), g(x) t title_g(c,d)                                                            

it results in

a picture i´m not allowed to post...

How can i make the green fittin-line only to run from 800-1200 and the blue fitting-line from 1100-end?

esrehmki
  • 177
  • 1
  • 7

1 Answers1

7

The syntax

plot [xmin:xmax] f(x)

(the same as for fit) restricts the plot to a certain range. So, you could do something like

plot "Daten.txt" u 1:2 w l, [800:1200] f(x) t title_f(a,b), [1100:] g(x) t title_g(c,d)
andyras
  • 15,542
  • 6
  • 55
  • 77
  • 1
    Note, that the second variant of piecewise defined ranges `plot [800:1200] x, [1100:] x**2` works only in the current development version (upcoming version 5.0), but not with 4.6 and earlier. – Christoph May 09 '14 at 14:05