Intersection of two curves
Show older comments
Hi,
I am trying to find the intersection point of two curves of different functions plotted in a same graph. Can someone help me to find the [x] value of the intersection point.
Thanks
N = [1 2 3 4 5 6]
P = [1.48982012272225e-09 1.20413388047633e-08 4.17435214011468e-08 1.03854604485768e-07 2.17722472607192e-07 4.11611145129198e-07]
f = [1254.80279734744 316.932254638916 144.685314017159 85.4215488617609 58.6806449463084 44.5833312773839]
The script is,
figure
yyaxis left
plot(N,Pi_I)
yyaxis right
plot(N,f)

1 Comment
Star Strider
on 14 Aug 2022
The curves do not intersect in the region-of-interest (defined by the ‘N’ vector).
It may be possible to force an intersection by extrapolating both of them, however I would not trust that result because you have no idea what the curves do outside the known values. They might never intersect, or they could have an infinite number of intersections if one or both are oscillatory and have appropriate magnitudes.
Accepted Answer
More Answers (2)
Do you see a point of intersection ? I don't.
N = [1 2 3 4 5 6];
P = [1.48982012272225e-09 1.20413388047633e-08 4.17435214011468e-08 1.03854604485768e-07 2.17722472607192e-07 4.11611145129198e-07];
f = [1254.80279734744 316.932254638916 144.685314017159 85.4215488617609 58.6806449463084 44.5833312773839];
plot(N,P)
hold on
plot(N,f)
2 Comments
Chinmayraj Doddarajappa
on 14 Aug 2022
Torsten
on 14 Aug 2022
Don't you see the different scales of the axes ?
The curves don't intersect (at least not within the region where data are available), as can be seen in the "real" plot above.
dpb
on 14 Aug 2022
One approach might be something like
R_PF=mean(P./f); % the average scaling between the two
fn1=@(x)interp1(N,f*R_PF,x); % interpolate the scaled values
fn2=@(x)interp1(N,P,x); % and the other
fnD=@(x)fn2(x)-fn1(x); % evaluate the difference between the two, for
x=interp1(fnD(N),N,0); % finding the zero point reverse lookup/interpolation for "X"
The above produces
>> x
x =
4.5738
>> fnD(x)
ans =
5.2940e-23
>>
1 Comment
Chinmayraj Doddarajappa
on 14 Aug 2022
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

