Clear Filters
Clear Filters

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

1 view (last 30 days)
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;

Accepted Answer

Star Strider
Star Strider on 10 Jan 2017
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

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!