How to find all the intersections of two lines.

1 view (last 30 days)
John
John on 21 Oct 2014
Answered: John on 21 Oct 2014
I've written a code to plot two equations but I'm trying to find the value of my variable t where the two equations intersect at the nine points. Does anyone know how I would tell matlab to find the solution at these nine points. The following is my code
>> a=20*10^(-6);
n1=1.455;
n2=1.440;
lambda=900*10^(-9);
k=2*pi/lambda;
k1=k*n1;
syms t;
phim=2*a*k1*cos(t);
eqls=tan(0.5*phim);
eqrs=sqrt(sin(t)^2-(n2/n1)^2)/cos(t);
hold on
ezplot(eqrs,[81.75*pi/180,pi/2])
ezplot(eqls,[81.75*pi/180,pi/2])
ylim([0,10])

Answers (1)

John
John on 21 Oct 2014
Nevermind just figured it out using
eq=eqrs-eqls; vpasolve(eq,t,init_guess)

Categories

Find more on Creating and Concatenating Matrices 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!