gnuplot> fit [1e9:1e13] a1+x '+' u 1:($1) via a1
Read 100 points
Skipped 100 points outside range [x=1e+09:1e+13]
No data to fit
(To add insult to injury, sometimes a very similar command would report a different number of points [like 50 or 69] — all skipped.)
It works OK¹⁾ with many ranges, like [1e20:1e23]
or [1:1e4]
.
¹⁾ Within the usual flackiness of `fit`.
Second attempt at a response. Just forget about anything I said the first time around.
I never use in-line ranges myself, so I always get confused when I see them as to exactly what they apply to. Unfortunately this confusion may extend to what the program thinks it means and what the user thinks it means.
There are several issues here. It looks like you expecting the program to figure out that it should generate appropriate samples spanning the range of '+'. This doesn't happen for your minimal example because neither the sampling range (
trange
) norxrange
is specified and no log-scaling is in effect. In the absence of atrange
specifier the program will thus generate uniform (equal interval) samples along the defaultxrange
, which is [-10:10]. All of these samples lie outside the fitting range[1.e9:1.e13]
. Thus the error message you see.So the first fix is to make the sampling range match the desired fit range. Usually this would mean
set trange [1.e9 : 1.e13]
but that isn't going to work here because you can't set log-scaling on the sample axis (noset log t
command). So instead you have to leavetrange
unspecified and setxrange
instead. Also you need to specify log-scaling on x.No range problems now, but the fit fails because the default initial value of a1 is 1.0 and the function being fit makes no sense. The next step would be to pick a more reasonable starting value for a1. Now you get this:
Without a reasonable function to fit I can't take the analysis any further than that.
hope that helps
Last edit: Ethan Merritt 2024-09-06
Yes, this was a user’s error. However, many issues triggered by the code abpve (and by your remarks) still remain. I will address them one-by-one.¹⁾
¹⁾ Here I decided to answer by collecting many not-related issues in one message. Since I sit on dozens of gnuplot bugs, let me know which format of discussion is more convenient to you in the future.
Right now I can see this indeed:
But a few days ago it would show the “rurrent” range as
[-5:5]
(on a freshly startedgnuplot
). Go figure!Why
set xrange
is needed when thefit
command specifies the x-range explicitly?This is a linear fit with coefficient 1. AFAIU, the Jacobian should be a 1×1 identity matrix. Why a problem to invert it?!
Which function makes no sense? I fit F(x) ⁻≡ x by f(x,a) ⁻≡ x+a. Which of them do you mean here?
How come a linear function with coefficient 1 is not “reasonable”? Is it related²⁾ to #2643 The FIT command fails in gnuplot Ver.5.4.8 on Windows 7 64-bit platform?
²⁾ Finally, I was able to make the fit I need in
octave
. It had similar problems, but it was a bit easier to debug. Judging by this experience, I would try to list the following (conjectural, undocumented) properties of the algorithm used byfit
x
andy
) in the datafile should be of approximately of the same magnitude (say, within a factor of 1,000).z
) in the datafile should be of approximately the same magnitude as the dependent variables.via
parameters one is looking for.³⁾ This part is not clear to me: “in which units” should one measure the gradient? Is it just dT/da? But what is the “target function” T? The square of the ℒ₂-norm of the misfit? Then this changes as one gets closer to the solution… Go figure again!
Is there a reason for this?
⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜
Additionally, when working over your answer(s), I found many issues in the docs. But this message gets too long, so I will try to discuss this later.