polyxpoly to find intersection
4 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
采纳的回答
KSSV
2020-4-24
编辑:KSSV
2020-4-25
You may consider this https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections?focused=5165138&tab=function to calculate the intersection points.
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')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!