I am plotting two equations against each other, I did this by creating a 2x100 array and a linspace. I have successfully plotted the curves, but I don't know how to find the values (of u and c) that they intersect at?
I have tried intersect(,)
, find(==)
, but they doesn't work with my problem, I think because it uses an if loop.
Here is my code:
clear all
A = 3;
B = 1.8;
d = 1;
c2 = 1;
c1 = 0.7;
s = 0.1;
c = linspace(0,1.5);
u = zeros(2,numel(c));
for i = 1:numel(c)
u(1,i)= c(i) / ((A/(c(i)+1))-(d*c(i)/(c(i)+c2))) ;
u(2,i)= B*c(i) /(c(i)+c1)-s;
end
hold on
plot(c,u(1,:),'r');
plot(c,u(2,:),'g');
hold off