How do I find and display the intersection of my functions?

1 回表示 (過去 30 日間)
Mo_B
Mo_B 2017 年 1 月 10 日
回答済み: Star Strider 2017 年 1 月 10 日
Hi guys,
I want to find the intersection of y3 and y4,
x=(0:0.5:80).';
y1=(0.02049/0.4)*x;
y2=(0.53*60./(1+(1.331./(sqrt(0.0631*x./(83.18-x))).^3)));
y3=(0.53*60./(1+(1.331./(sqrt(0.0631*x./(83.18-x))).^3)))-(0.02049/0.4)*x;
y4=(0.02049/0.4)*x-(0.53*60./(1+(1.331./(sqrt(0.0631*x./(83.18-x))).^3)));
figure
plot(x,y1,'r')
hold on
plot(x,y2,'c')
plot(x,y3,'g')
plot(x,y4,'b')
legend('Line1','Line2','Line3','Line4')
axis([0 80 -1 3.5])
i tried to use
C = intersect(y3,y4)
I get C = 0, but I want the intersection near x = 70;

採用された回答

Star Strider
Star Strider 2017 年 1 月 10 日
Try this:
x = linspace(0, 80, 200);
y3 = @(x) (0.53*60./(1+(1.331./(sqrt(0.0631*x./(83.18-x))).^3)))-(0.02049/0.4)*x;
y4 = @(x) (0.02049/0.4)*x-(0.53*60./(1+(1.331./(sqrt(0.0631*x./(83.18-x))).^3)));
y34 = @(x) y3(x) - y4(x); % Subtract Functions
x0 = 40;
xi = fzero(y34, x0);
figure(1)
plot(x, y3(x), x, y4(x))
hold on
plot(xi, y3(xi), 'pr')
hold off
grid
xi =
68.8010

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by