Finding the intersection points between two curves

6 ビュー (過去 30 日間)
raha ahmadi
raha ahmadi 2021 年 7 月 30 日
コメント済み: Star Strider 2021 年 8 月 7 日
I need to find the intersection points of this equation:
this is my code. I dont know what is the best way . Also when I plot in terms of I have some periods but when I plot in terms of β I have only one period. How I can plot it in terms of beta but with nulti perids?
many thanks in advance
h=20;
K=13.6;
l=1148e-6;
g1=fplot(@(beta)tan(beta*l));
hold on
g2=fplot(@(beta)2*h*beta*K/(K^2*beta^2-h^2));
Warning: Function behaves unexpectedly on array inputs. To improve performance, properly vectorize your function to return an output with the same size and shape as the input arguments.

採用された回答

Star Strider
Star Strider 2021 年 7 月 30 日
Several options —
h=20;
K=13.6;
l=1148e-6;
f1 = @(beta)tan(beta*l);
f2 = @(beta)2*h*beta*K./(K^2*beta.^2-h^2);
figure
g1 = fplot(f1);
hold on
g2 = fplot(f2);
g3 = fplot(@(beta) f2(beta)-f1(beta), '--'); % Use 'fsolve' On 'g3' To Find The Intersections
Another option:
format long
Xint = interp1(g3.YData, g3.XData, 0)
Xint =
0
.
  11 件のコメント
raha ahmadi
raha ahmadi 2021 年 8 月 7 日
your answer is perfect. I m really appresiate.
hope you all the best
Star Strider
Star Strider 2021 年 8 月 7 日
Thank you!
As always, my pleasure!
.

サインインしてコメントする。

その他の回答 (1 件)

darova
darova 2021 年 7 月 30 日
I'd try fsolve for solving
Read help carefully:
fplot(f,[0 10])
  1 件のコメント
raha ahmadi
raha ahmadi 2021 年 7 月 30 日
編集済み: raha ahmadi 2021 年 7 月 30 日
Dear darova
Thank you for your help, I read fsolve but I think it solves a system of nonlinear equations. I used fzero instead but I only got one answer I need solve it in some periods and get more roots
Best regards

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by