MATLAB Answers

0

How to find intersection point of two curves, when the intersection point is not there in data sets?

Asked by manoj saladi on 14 Apr 2019
Latest activity Edited by dpb
on 14 Apr 2019
Accepted Answer by dpb
Hi,
I have two curves like as shown in the picture.
Capture1.PNG
neither of x and y coordinates of the intersection point are not there in the data sets of the two curves. But finding exact intersection point is essential for me, since Im gonna use this data in 1d looup tables where it is showing that breakpoints should increase monotonically. So, in brief the blue curve should immediately start after the intersection point, I want to exactly remove data of red and blue curves after intersection point. Is there any possibility doing that?
Thanks in advance

  0 Comments

Sign in to comment.

Products


Release

R2017b

1 Answers

Answer by dpb
on 14 Apr 2019
 Accepted Answer

Both intersection sections appear to be straight lines; fit them and use fzero to find the point
bblue=polyfit(xblue,yblue,1); % fit the LH section of blue curve
bred=polyfit(xbred,yred,1); % fit the red curve
x0=fzero(@(x) polyval(bblue(x)-polyval(bred(x))),xred(1)); % find intersection
NB: I typed fzero line by memory in editor; check the documentation for exact syntax if it doesn't work as written

  3 Comments

Hi,
The red curve is actually semicircle and blue curve is some cuve with an average slope of 135 degrees, but its not a straight line.
Hi,
Can you please explain in bit more detail?
Thank you.
Well, fit any functional that works--for no more curvature than shown there, a quadratic would likely be very close fit (I'd guess the linear would still be quite adequate, but you can test).
What's left to explain? Use fzero to find the X where the two lines cross (their difference is zero).
Or, if you have a functional form that is generating them and not just data points, then use the two exact functionals.
You've not given us any specifics to work from for more details...the data or the functional form of the lines would be the most helpful thing to post/attach.

Sign in to comment.



Translated by