5

Simple question - the range drawn on a plot can be changed with the set xrange [x_min:x_max] command.

Does this command also limit the range used when fitting a function using the data fitting tools in gnuplot? Is there a way to manually specify the ranged used for function fits? (One guess might be the command every? Do I need to over-ride xrange using every?)

The reason I ask is that I am using xrange to plot outputs zoomed in on the low value x region to view transient behaviour more clearly, but I think this may be "slicing off" values from the function fitting at larger x values outside the xrange region selected?

4

2 に答える 2

7

これは古い質問ですが、現在の回答は正しくありxrangeません。fit コマンドの一部として明示的な範囲が指定されていない場合、現在の設定はフィッティングに使用される範囲に影響します。これは、簡単な例で簡単に確認できますtest.dat

1 1
2 2
3 3
4 4
5 6
6 8
7 10
8 12

線形フィットを使用すると、次のようになります。

fit a+b*x "test.dat" via a,b
plot "test.dat" w p, a+b*x w l

ここに画像の説明を入力

フィット パラメータ (a,b)=(-1.42, 1.59)。ただし、最初に を設定するxrangeと、

set xrange [4:8]
fit a+b*x "test.dat" via a,b
plot "test.dat" w p, a+b*x w l

ここに画像の説明を入力

適合パラメータ (a,b)=(-4,2)。

これは、少なくとも gnuplot 5.2 の現在の動作ですが、2009 年のこの古いスレッドは、これがかなり長い間動作していたことを示唆しています。

于 2017-12-10T06:35:37.603 に答える
3

set xrange [x_min:x_max]関数をフィッティングするときに使用される範囲には影響しません。

コマンドを使用するfitと (同じことが にも当てはまりplotます)、次の構文を使用して、変数に適合するように範囲を明示的に制限できます。

[{dummy_variable=}{<min>}{:<max>}]

たとえば、次のように x 軸の範囲を制限できます。

fit [min:max] f(x) "filename"
于 2015-06-29T22:47:43.793 に答える