 # Difference between 2 lines and adaptative grid

Hi all,

I apologize for beeing slightly off-topic with this question, but I couldn't

Consider two vectors x1 and y1. Using matplotlib, plot(x1,y1) will display the
line joining all points whose coordinates are (x1(i),y1(i))
Now, consider another couple of vectors x2 and y2.
Using plot(x1,y1,x2,y2) we are shown the 2 lines corresponding to (x1,y1) and
(x2,y2), and we can compare these two lines with the naked eye

My question is, how to do this quantitatively ? Is there a way of calculating
the difference between the two sets of points, and then plot this difference,
using matplotlib ? I mean, if the data was generated using a fixed grid, it
would be enough to plot (y2-y1) but with an adaptative grid, x1 and x2
differ. Do you know about a quick & dirty way to achieve this ?

cheers,
Nicolas

Hi,

you can look in the direction of polyfit, polyval function to do what do you want.

Regards,

N

Nicolas Girard wrote:

···

Hi all,

I apologize for beeing slightly off-topic with this question, but I couldn't think about a better place to ask :-/

Consider two vectors x1 and y1. Using matplotlib, plot(x1,y1) will display the line joining all points whose coordinates are (x1(i),y1(i))
Now, consider another couple of vectors x2 and y2.
Using plot(x1,y1,x2,y2) we are shown the 2 lines corresponding to (x1,y1) and (x2,y2), and we can compare these two lines with the naked eye

My question is, how to do this quantitatively ? Is there a way of calculating the difference between the two sets of points, and then plot this difference, using matplotlib ? I mean, if the data was generated using a fixed grid, it would be enough to plot (y2-y1) but with an adaptative grid, x1 and x2 differ. Do you know about a quick & dirty way to achieve this ?