I'm wondering if it's possible to plot a graph of the difference between two graphs.
I have one line graph from a theoretical equation, and another line graph from my experiment. I want to draw a graph of the difference between the two lines.
How can I do this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Subject: [gnuplot:discussion] Difference between graphs
To: "[gnuplot:discussion]" 5925@discussion.gnuplot.p.re.sf.net
Date: Sunday, March 15, 2015, 10:40 AM
I'm wondering
if it's possible to plot a graph of the difference
between two graphs.
I have one line graph from a theoretical equation, and
another line graph from my experiment. I want to draw a
graph of the difference between the two lines.
How can I do this?
Sorry, to clarify:
I inserted my theoretical equation in the gnuplot document I have, whilst my experiment curve comes from a data text file. What you mention is only from a single data text file I think?
Is it possible to calculate the difference from an equation and data from a text file?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have to evaluate your equation at the same X values as your data. That's what the (f($1)-$2) or as I suggested, (f($1)/$2), is for. I do this all the time developing empirical fits to data.
For example a 2nd order polynomial fit to two columns of data:
f(x) = a0 + a1x + a2x**2
fit f(x) 'a' u 1:2 via a0,a1,a2
plot 'a' u 1:2 ,f(x)
plot 'a' u 1:(f($1)/$2)
Think about what you're trying to do and write out the math and draw a figure on a piece of paper. You're making the problem harder than it is.
Subject: [gnuplot:discussion] Difference between graphs
To: "[gnuplot:discussion]" 5925@discussion.gnuplot.p.re.sf.net
Date: Sunday, March 15, 2015, 11:48 AM
Sorry, to clarify:
I inserted my theoretical equation in the gnuplot document I
have, whilst my experiment curve comes from a data text
file. What you mention is only from a single data text file
I think?
Is it possible to calculate the difference from an
equation and data from a text file?
I'm wondering if it's possible to plot a graph of the difference between two graphs.
I have one line graph from a theoretical equation, and another line graph from my experiment. I want to draw a graph of the difference between the two lines.
How can I do this?
It's trivial.
plot 'a' u 1:(f($1)-$2)
or similar. Personally I suggest using f($1)/$2 if $2 is non-zero. That gives you the fractional error of the approximation.
Have Fun!
Reg
On Sun, 3/15/15, brijmohan brijmohan3@users.sf.net wrote:
Subject: [gnuplot:discussion] Difference between graphs
To: "[gnuplot:discussion]" 5925@discussion.gnuplot.p.re.sf.net
Date: Sunday, March 15, 2015, 10:40 AM
I'm wondering
if it's possible to plot a graph of the difference
between two graphs.
I have one line graph from a theoretical equation, and
another line graph from my experiment. I want to draw a
graph of the difference between the two lines.
How can I do this?
Difference
between graphs
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/
Sorry, to clarify:
I inserted my theoretical equation in the gnuplot document I have, whilst my experiment curve comes from a data text file. What you mention is only from a single data text file I think?
Is it possible to calculate the difference from an equation and data from a text file?
You have to evaluate your equation at the same X values as your data. That's what the (f($1)-$2) or as I suggested, (f($1)/$2), is for. I do this all the time developing empirical fits to data.
For example a 2nd order polynomial fit to two columns of data:
f(x) = a0 + a1x + a2x**2
fit f(x) 'a' u 1:2 via a0,a1,a2
plot 'a' u 1:2 ,f(x)
plot 'a' u 1:(f($1)/$2)
Think about what you're trying to do and write out the math and draw a figure on a piece of paper. You're making the problem harder than it is.
Have Fun!
Reg
On Sun, 3/15/15, brijmohan brijmohan3@users.sf.net wrote:
Subject: [gnuplot:discussion] Difference between graphs
To: "[gnuplot:discussion]" 5925@discussion.gnuplot.p.re.sf.net
Date: Sunday, March 15, 2015, 11:48 AM
Sorry, to clarify:
I inserted my theoretical equation in the gnuplot document I
have, whilst my experiment curve comes from a data text
file. What you mention is only from a single data text file
I think?
Is it possible to calculate the difference from an
equation and data from a text file?
Difference
between graphs
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/
Ah okay, that makes sense now.
Thank you