【问题标题】:MATLAB- How to find multiple x and y intersection points from two curvesMATLAB-如何从两条曲线中找到多个 x 和 y 交点
【发布时间】:2016-12-07 08:36:45
【问题描述】:

在下图中,两条曲线相交于 3 个点。一个在左边,一个在中间,一个在右边。我需要找到三个交点的 (x,y) 坐标,但我很难弄清楚如何做到这一点。以下是我到目前为止的代码和情节:

Click here for plot

这是我的代码:

% Define

b1=3.5;
b2=4.5;
rho1=2.7;
rho2=3.3;
h=40;
u2=(b2^2)*rho2;


f1=.15;
w1=2*pi*f1;
cvec=3.5:.01:4.5;
p2=1./cvec;
lhs=tan(h*w1.*sqrt((1./b1.^2)-(p2.^2)));
rhs=(u2.*sqrt((p2.^2)-(1./b2.^2)))./(u1.*sqrt((1./b1.^2)-(p2.^2)));

plot(cvec,rhs,cvec,lhs)
xlim([3.6 4.6])

【问题讨论】:

    标签: matlab intersection


    【解决方案1】:

    您的代码无法执行(缺少u1)。不过不管怎样,你可以减去lhs-rhs然后再找结果zero-crossing

    zci = @(v) find( v(1:end-1).*circshift(v(2:end), [-1 0]) <= 0); % Returns Zero-Crossing Indices Of Argument Vector
    zx = zci(lhs-rhs);
    cross_points = cvec(zx)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多