polyxpoly to find intersection

6 visualizaciones (últimos 30 días)
vipul kumar
vipul kumar el 24 de Abr. de 2020
Comentada: vipul kumar el 25 de Abr. de 2020
i have two curves as given in the code 'p' and 'q' for diffeent values of 'x' the curves intersect at different points. Can anyone tell me why is my code not running?
clc
clf
b=linspace(0,1);
x=8;
p= x.*(sqrt(1-b)).*(((besselj(1,x.*sqrt(1-b)))./(besselj(0,x.*sqrt(1-b)))));
q = x.*(sqrt(b)).*((besselk(1,x.*sqrt(b)))./(besselk(0,x.*sqrt(b))));
plot(b,p)
hold on
plot(b,q)
[xx,yy] = polyxpoly(b,p,b,q)

Respuesta aceptada

KSSV
KSSV el 24 de Abr. de 2020
Editada: KSSV el 25 de Abr. de 2020
Save the above function in your working folder and use the below code.
clc
clf
b=linspace(0,1);
x=8;
p= x.*(sqrt(1-b)).*(((besselj(1,x.*sqrt(1-b)))./(besselj(0,x.*sqrt(1-b)))));
q = x.*(sqrt(b)).*((besselk(1,x.*sqrt(b)))./(besselk(0,x.*sqrt(b))));
L1 = [b ;p] ;
L2 = [b ;q] ;
P = InterX(L1,L2) ; % get intersection points using the function
plot(b,p)
hold on
plot(b,q)
plot(P(1,:),P(2,:),'*r')
  13 comentarios
vipul kumar
vipul kumar el 25 de Abr. de 2020
ohh, you edited the parent question. My bad. Got it bruh, thanks a lot.
vipul kumar
vipul kumar el 25 de Abr. de 2020
There is one more thing, if you lookt at it. Since the function goes to infinity so the intersection point generated in the graph are more i.e. if you look from the right of the graph, only alternate points are taken into account. First relevent point is the rightmost and then alternate are to be taken.
I verified this with the data given but can not find the exact explanation why does it give one extra point after one relevant one?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by