How to obtain point data from a fitting curve?
I plotted curves by fitting some existing points using gnuplot.
code as followings:
f1(x)=a1/(x**b1)+c1
fit f1(x) "41a091_input.txt" u 1:2 via a1,b1,c1
plot f1(x) with line lt 1 lw 4 lc rgb "blue" notitle,
'41a091_input.txt' using 1:2:3 with yerrorbars lw 2.2 lc rgb "blue" title "∑41a(091)"
Data as followings:
21.8124 1.11693 0.00545168
30.8669 1.07328 0.00485237
44.6701 1.04708 0.00411839
53.6699 1.03787 0.00301346
75.9751 1.02555 0.00304312
My question is:
How to get data from any point on this curve?
Like when x=50?
gnuplot curve-fitting
add a comment |
I plotted curves by fitting some existing points using gnuplot.
code as followings:
f1(x)=a1/(x**b1)+c1
fit f1(x) "41a091_input.txt" u 1:2 via a1,b1,c1
plot f1(x) with line lt 1 lw 4 lc rgb "blue" notitle,
'41a091_input.txt' using 1:2:3 with yerrorbars lw 2.2 lc rgb "blue" title "∑41a(091)"
Data as followings:
21.8124 1.11693 0.00545168
30.8669 1.07328 0.00485237
44.6701 1.04708 0.00411839
53.6699 1.03787 0.00301346
75.9751 1.02555 0.00304312
My question is:
How to get data from any point on this curve?
Like when x=50?
gnuplot curve-fitting
add a comment |
I plotted curves by fitting some existing points using gnuplot.
code as followings:
f1(x)=a1/(x**b1)+c1
fit f1(x) "41a091_input.txt" u 1:2 via a1,b1,c1
plot f1(x) with line lt 1 lw 4 lc rgb "blue" notitle,
'41a091_input.txt' using 1:2:3 with yerrorbars lw 2.2 lc rgb "blue" title "∑41a(091)"
Data as followings:
21.8124 1.11693 0.00545168
30.8669 1.07328 0.00485237
44.6701 1.04708 0.00411839
53.6699 1.03787 0.00301346
75.9751 1.02555 0.00304312
My question is:
How to get data from any point on this curve?
Like when x=50?
gnuplot curve-fitting
I plotted curves by fitting some existing points using gnuplot.
code as followings:
f1(x)=a1/(x**b1)+c1
fit f1(x) "41a091_input.txt" u 1:2 via a1,b1,c1
plot f1(x) with line lt 1 lw 4 lc rgb "blue" notitle,
'41a091_input.txt' using 1:2:3 with yerrorbars lw 2.2 lc rgb "blue" title "∑41a(091)"
Data as followings:
21.8124 1.11693 0.00545168
30.8669 1.07328 0.00485237
44.6701 1.04708 0.00411839
53.6699 1.03787 0.00301346
75.9751 1.02555 0.00304312
My question is:
How to get data from any point on this curve?
Like when x=50?
gnuplot curve-fitting
gnuplot curve-fitting
edited Nov 29 '18 at 18:59
Christoph
39.1k847122
39.1k847122
asked Nov 29 '18 at 0:27
JunChaiJunChai
83
83
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
well, you have your fitting function f1(x)
and the parameters a1,b1,c1
have been fitted. So, in order to get the value at x=50
, simply type print f1(50)
.
Or if you want to plot it:
### start code
reset session
$Data <<EOD
21.8124 1.11693 0.00545168
30.8669 1.07328 0.00485237
44.6701 1.04708 0.00411839
53.6699 1.03787 0.00301346
75.9751 1.02555 0.00304312
EOD
f1(x)=a1/(x**b1)+c1
fit f1(x) $Data u 1:2 via a1,b1,c1
print sprintf("a1: %g, b1: %g, c1: %g", a1,b1,c1)
XValue = 50
set label 1 at XValue,f1(XValue)+0.01 sprintf("f1(%g): %g",XValue,f1(XValue))
set arrow 1 from XValue,graph 0 to XValue,graph 1 nohead ls 0
plot f1(x) with line lt 1 lw 4 lc rgb "blue" notitle,
$Data using 1:2:3 with yerrorbars lw 2.2 lc rgb "blue" title "∑41a(091)",
[XValue:XValue] f1(XValue) w p lt 6 lc rgb "red" ps 2
### end of code
which results in something like:
OMG you saved my life! That works! However i still do not understand some details, like what does [XValue:XValue] using for?
– JunChai
Nov 29 '18 at 15:40
And what if i want to add a vertical dashed line through this point?
– JunChai
Nov 29 '18 at 15:55
just remove the[XValue:XValue]
and see what will happen. This limits the range to one datapoint. Vertical dashed line: for example withset arrow 1 from XValue, graph 0 to XValue, graph 1 nohead ls 0
Maybe there are better ways to achieve both things.
– theozh
Nov 29 '18 at 18:48
Probably a better way to plot a single pointplot '+' using (XValue):(f1(XValue)) w p lt 6 lc rgb "red" ps 2
– theozh
Nov 29 '18 at 21:30
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53530121%2fhow-to-obtain-point-data-from-a-fitting-curve%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
well, you have your fitting function f1(x)
and the parameters a1,b1,c1
have been fitted. So, in order to get the value at x=50
, simply type print f1(50)
.
Or if you want to plot it:
### start code
reset session
$Data <<EOD
21.8124 1.11693 0.00545168
30.8669 1.07328 0.00485237
44.6701 1.04708 0.00411839
53.6699 1.03787 0.00301346
75.9751 1.02555 0.00304312
EOD
f1(x)=a1/(x**b1)+c1
fit f1(x) $Data u 1:2 via a1,b1,c1
print sprintf("a1: %g, b1: %g, c1: %g", a1,b1,c1)
XValue = 50
set label 1 at XValue,f1(XValue)+0.01 sprintf("f1(%g): %g",XValue,f1(XValue))
set arrow 1 from XValue,graph 0 to XValue,graph 1 nohead ls 0
plot f1(x) with line lt 1 lw 4 lc rgb "blue" notitle,
$Data using 1:2:3 with yerrorbars lw 2.2 lc rgb "blue" title "∑41a(091)",
[XValue:XValue] f1(XValue) w p lt 6 lc rgb "red" ps 2
### end of code
which results in something like:
OMG you saved my life! That works! However i still do not understand some details, like what does [XValue:XValue] using for?
– JunChai
Nov 29 '18 at 15:40
And what if i want to add a vertical dashed line through this point?
– JunChai
Nov 29 '18 at 15:55
just remove the[XValue:XValue]
and see what will happen. This limits the range to one datapoint. Vertical dashed line: for example withset arrow 1 from XValue, graph 0 to XValue, graph 1 nohead ls 0
Maybe there are better ways to achieve both things.
– theozh
Nov 29 '18 at 18:48
Probably a better way to plot a single pointplot '+' using (XValue):(f1(XValue)) w p lt 6 lc rgb "red" ps 2
– theozh
Nov 29 '18 at 21:30
add a comment |
well, you have your fitting function f1(x)
and the parameters a1,b1,c1
have been fitted. So, in order to get the value at x=50
, simply type print f1(50)
.
Or if you want to plot it:
### start code
reset session
$Data <<EOD
21.8124 1.11693 0.00545168
30.8669 1.07328 0.00485237
44.6701 1.04708 0.00411839
53.6699 1.03787 0.00301346
75.9751 1.02555 0.00304312
EOD
f1(x)=a1/(x**b1)+c1
fit f1(x) $Data u 1:2 via a1,b1,c1
print sprintf("a1: %g, b1: %g, c1: %g", a1,b1,c1)
XValue = 50
set label 1 at XValue,f1(XValue)+0.01 sprintf("f1(%g): %g",XValue,f1(XValue))
set arrow 1 from XValue,graph 0 to XValue,graph 1 nohead ls 0
plot f1(x) with line lt 1 lw 4 lc rgb "blue" notitle,
$Data using 1:2:3 with yerrorbars lw 2.2 lc rgb "blue" title "∑41a(091)",
[XValue:XValue] f1(XValue) w p lt 6 lc rgb "red" ps 2
### end of code
which results in something like:
OMG you saved my life! That works! However i still do not understand some details, like what does [XValue:XValue] using for?
– JunChai
Nov 29 '18 at 15:40
And what if i want to add a vertical dashed line through this point?
– JunChai
Nov 29 '18 at 15:55
just remove the[XValue:XValue]
and see what will happen. This limits the range to one datapoint. Vertical dashed line: for example withset arrow 1 from XValue, graph 0 to XValue, graph 1 nohead ls 0
Maybe there are better ways to achieve both things.
– theozh
Nov 29 '18 at 18:48
Probably a better way to plot a single pointplot '+' using (XValue):(f1(XValue)) w p lt 6 lc rgb "red" ps 2
– theozh
Nov 29 '18 at 21:30
add a comment |
well, you have your fitting function f1(x)
and the parameters a1,b1,c1
have been fitted. So, in order to get the value at x=50
, simply type print f1(50)
.
Or if you want to plot it:
### start code
reset session
$Data <<EOD
21.8124 1.11693 0.00545168
30.8669 1.07328 0.00485237
44.6701 1.04708 0.00411839
53.6699 1.03787 0.00301346
75.9751 1.02555 0.00304312
EOD
f1(x)=a1/(x**b1)+c1
fit f1(x) $Data u 1:2 via a1,b1,c1
print sprintf("a1: %g, b1: %g, c1: %g", a1,b1,c1)
XValue = 50
set label 1 at XValue,f1(XValue)+0.01 sprintf("f1(%g): %g",XValue,f1(XValue))
set arrow 1 from XValue,graph 0 to XValue,graph 1 nohead ls 0
plot f1(x) with line lt 1 lw 4 lc rgb "blue" notitle,
$Data using 1:2:3 with yerrorbars lw 2.2 lc rgb "blue" title "∑41a(091)",
[XValue:XValue] f1(XValue) w p lt 6 lc rgb "red" ps 2
### end of code
which results in something like:
well, you have your fitting function f1(x)
and the parameters a1,b1,c1
have been fitted. So, in order to get the value at x=50
, simply type print f1(50)
.
Or if you want to plot it:
### start code
reset session
$Data <<EOD
21.8124 1.11693 0.00545168
30.8669 1.07328 0.00485237
44.6701 1.04708 0.00411839
53.6699 1.03787 0.00301346
75.9751 1.02555 0.00304312
EOD
f1(x)=a1/(x**b1)+c1
fit f1(x) $Data u 1:2 via a1,b1,c1
print sprintf("a1: %g, b1: %g, c1: %g", a1,b1,c1)
XValue = 50
set label 1 at XValue,f1(XValue)+0.01 sprintf("f1(%g): %g",XValue,f1(XValue))
set arrow 1 from XValue,graph 0 to XValue,graph 1 nohead ls 0
plot f1(x) with line lt 1 lw 4 lc rgb "blue" notitle,
$Data using 1:2:3 with yerrorbars lw 2.2 lc rgb "blue" title "∑41a(091)",
[XValue:XValue] f1(XValue) w p lt 6 lc rgb "red" ps 2
### end of code
which results in something like:
edited Nov 29 '18 at 18:50
answered Nov 29 '18 at 5:48
theozhtheozh
1,578312
1,578312
OMG you saved my life! That works! However i still do not understand some details, like what does [XValue:XValue] using for?
– JunChai
Nov 29 '18 at 15:40
And what if i want to add a vertical dashed line through this point?
– JunChai
Nov 29 '18 at 15:55
just remove the[XValue:XValue]
and see what will happen. This limits the range to one datapoint. Vertical dashed line: for example withset arrow 1 from XValue, graph 0 to XValue, graph 1 nohead ls 0
Maybe there are better ways to achieve both things.
– theozh
Nov 29 '18 at 18:48
Probably a better way to plot a single pointplot '+' using (XValue):(f1(XValue)) w p lt 6 lc rgb "red" ps 2
– theozh
Nov 29 '18 at 21:30
add a comment |
OMG you saved my life! That works! However i still do not understand some details, like what does [XValue:XValue] using for?
– JunChai
Nov 29 '18 at 15:40
And what if i want to add a vertical dashed line through this point?
– JunChai
Nov 29 '18 at 15:55
just remove the[XValue:XValue]
and see what will happen. This limits the range to one datapoint. Vertical dashed line: for example withset arrow 1 from XValue, graph 0 to XValue, graph 1 nohead ls 0
Maybe there are better ways to achieve both things.
– theozh
Nov 29 '18 at 18:48
Probably a better way to plot a single pointplot '+' using (XValue):(f1(XValue)) w p lt 6 lc rgb "red" ps 2
– theozh
Nov 29 '18 at 21:30
OMG you saved my life! That works! However i still do not understand some details, like what does [XValue:XValue] using for?
– JunChai
Nov 29 '18 at 15:40
OMG you saved my life! That works! However i still do not understand some details, like what does [XValue:XValue] using for?
– JunChai
Nov 29 '18 at 15:40
And what if i want to add a vertical dashed line through this point?
– JunChai
Nov 29 '18 at 15:55
And what if i want to add a vertical dashed line through this point?
– JunChai
Nov 29 '18 at 15:55
just remove the
[XValue:XValue]
and see what will happen. This limits the range to one datapoint. Vertical dashed line: for example with set arrow 1 from XValue, graph 0 to XValue, graph 1 nohead ls 0
Maybe there are better ways to achieve both things.– theozh
Nov 29 '18 at 18:48
just remove the
[XValue:XValue]
and see what will happen. This limits the range to one datapoint. Vertical dashed line: for example with set arrow 1 from XValue, graph 0 to XValue, graph 1 nohead ls 0
Maybe there are better ways to achieve both things.– theozh
Nov 29 '18 at 18:48
Probably a better way to plot a single point
plot '+' using (XValue):(f1(XValue)) w p lt 6 lc rgb "red" ps 2
– theozh
Nov 29 '18 at 21:30
Probably a better way to plot a single point
plot '+' using (XValue):(f1(XValue)) w p lt 6 lc rgb "red" ps 2
– theozh
Nov 29 '18 at 21:30
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53530121%2fhow-to-obtain-point-data-from-a-fitting-curve%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown