I want to do the linear fitting for my data within a specific range . So, I used
f(x) = a*x
fit [800:1400] f(x) "filename" using 1:2 via a. However, it seems to me that the fitting line does not fit well to the range that I specified. Could you help clarify this? I have attached the screenshot below.
Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you. I just have one more question. How can I plot the whole data set and plot the fitted line within a specific region? If I specify the range in the plot function, the range applies for both data set and the fit.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Perhaps your fit executed in the range where you specifid. y =a x should takes value 0 at x =0 and across the data near the range you specify. If you fit using a * x + b, what happenes?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, the equation should be y=ax+b. we could not just set the intercept to be zero, which is not possible to fit the linear region in the data set. Also, when I make the plot, how can I plot the whole data set and the fit which is only from [800:*].?
The range in the plot function applies to both the data and the fit. I could not specify the range for each of them.
Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
$dat << EOD
0, 0
1, 1.1
2, 3.9
3, 8.8
4, 18.2
5, 24.7
6, 36.0
7, 48.5
8, 64.3
9, 80.9
10, 100.2
EOD
fit [6:11] a * x + b $dat using 1:2 via a, b
plot $dat, a * x + b
Thank you. As I want to show the the transition from non-linear to linear region, I want to plot the whole data. However, for the fit, I only want the fit to cover the specified range on the plot (like what we do in excel). I was wondering how we can do that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I executed Karl's suggestion after my script and got the attached the plot. As far as my understading, this is what you want, is not it? (I want to plot the whole data. However, for the fit, I only want the fit to cover the specified range on the plot )
Appreciate your input. I'm working on plotting a dataset and would like to illustrate the transition from non-linearity to linearity. While I intend to show the entire dataset, I'm interested in limiting the fit to a specified range, akin to Excel's functionality. Is there a method to accomplish this tailored range for the plot?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Appreciate your input. I'm working on plotting a dataset and would like to illustrate the transition from non-linearity to linearity. While I intend to show the entire dataset, I'm interested in limiting the fit to a specified range, akin to Excel's functionality. Is there a method to accomplish this tailored range for the plot?
Hello,
I want to do the linear fitting for my data within a specific range . So, I used
f(x) = a*x
fit [800:1400] f(x) "filename" using 1:2 via a. However, it seems to me that the fitting line does not fit well to the range that I specified. Could you help clarify this? I have attached the screenshot below.
Thank you.
screenshot below
The solution you got is bad because the problem, as stated, is bad.
There is no better value for 'a' for that (subset of the) data, and that function. The function simply does not fit at all.
Last edit: Hans-Bernhard Broeker 2023-03-26
Thank you. I just have one more question. How can I plot the whole data set and plot the fitted line within a specific region? If I specify the range in the plot function, the range applies for both data set and the fit.
Perhaps your fit executed in the range where you specifid. y =a x should takes value 0 at x =0 and across the data near the range you specify. If you fit using a * x + b, what happenes?
Yes, the equation should be y=ax+b. we could not just set the intercept to be zero, which is not possible to fit the linear region in the data set. Also, when I make the plot, how can I plot the whole data set and the fit which is only from [800:*].?
The range in the plot function applies to both the data and the fit. I could not specify the range for each of them.
Thank you.
Last edit: Tatsuro MATSUOKA 2023-03-27
You can (should, usually, from a scientific point) also limit the plot to the range for which you did the fit.
Thank you. As I want to show the the transition from non-linear to linear region, I want to plot the whole data. However, for the fit, I only want the fit to cover the specified range on the plot (like what we do in excel). I was wondering how we can do that.
I executed Karl's suggestion after my script and got the attached the plot. As far as my understading, this is what you want, is not it? (I want to plot the whole data. However, for the fit, I only want the fit to cover the specified range on the plot )
Last edit: Tatsuro MATSUOKA 2023-03-28
Appreciate your input. I'm working on plotting a dataset and would like to illustrate the transition from non-linearity to linearity. While I intend to show the entire dataset, I'm interested in limiting the fit to a specified range, akin to Excel's functionality. Is there a method to accomplish this tailored range for the plot?
Specify the range of the fit as the first argument c.f. 'he;p fit'
Appreciate your input. I'm working on plotting a dataset and would like to illustrate the transition from non-linearity to linearity. While I intend to show the entire dataset, I'm interested in limiting the fit to a specified range, akin to Excel's functionality. Is there a method to accomplish this tailored range for the plot?
Question about setting the range for fit function
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/gnuplot/discussion/5925/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/