MATLAB: Extrapolating dataset and find intersection


Hello there,
I'm quite new to Matlab and stuck at a problem for a while and thus this is my first question.
What I have: A (x/y) dataset which is depicted by the blue line in the figure below
What I want:
  • Two extrapolating lines (depicted by dotted lines) through the maximum slope of the peak and the "ground" line respectively
  • Intersection Point of these lines to retrieve its x-coordinate
What I have tried: I tried using the following line for a first try, just to see what happens, however I am unable to plot the extrapolated line (Error Msg. Vectors must be the same length)
As said I have not that much experience yet so I would highly appreciate any helpful input for solving this particular problem.
Best regards

Best Answer

  • You should be having coordinates of the lines: use this: