From: zhang on
Hi guys

How to get the intersection of two lines in matlab?

Thanks in advanced.

Zhong
From: Matt Fig on
Many ways. If you have functions, you could do:

% Data
y1 = @(x) 5.4*x + 3;
y2 = @(x) 2.7*x+4;

% Engine
rt = fzero(@(x)y1(x)-y2(x),5);

% Check
x = -10:.1:10;
plot(x,y1(x),'r',x,y2(x),'b',rt,y1(rt),'*k')