title: matlab distance between two curves
body: <p>I have two sets of x,y data. The plot of those data can be seen in figure below:</p>
  
  <p><img src="https://i.stack.imgur.com/5HRcn.png" alt="enter image description here"></p>
  
  <p>Let say, if the blue line is the reference, how can I calculate the distance between the blue line and the red line? To make it clearer, if the red line is behind the blue line, the difference will be negative and vice versa. </p>
  
  <p>I've tried using pdist, but I think this is not the solution I want.</p>
  
  <p>Any help will be really appreciated.
  Thank you</p>