How do I find and display the intersection of my functions?
조회 수: 1 (최근 30일)
이전 댓글 표시
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;
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!