Menu

Difference between graphs

Help
brijmohan
2015-03-15
2015-03-15
  • brijmohan

    brijmohan - 2015-03-15

    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?

     
    • Reginald Beardsley

      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/

       
  • brijmohan

    brijmohan - 2015-03-15

    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?

     
    • Reginald Beardsley

      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/

       
  • brijmohan

    brijmohan - 2015-03-15

    Ah okay, that makes sense now.

    Thank you

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.