Point of intersection of 'symbolic' curves
Show older comments
Consider the code segment
syms e
y1 = sqrt(8-e);
ezplot(y1)
y_sym = sqrt(e) * tan(pi/2 * sqrt(e));
y_ant_sym =-sqrt(e) * cot(pi/2 * sqrt(e));
hold on
ezplot(y_sym)
ezplot(y_ant_sym)
Now consider the curves generated by plotting the functions y1, y_sym and y_ant_sym.
I want to find the point(s) of intersection of the curves y_sym and y_ant_sym with the curve y1.
I know there are work-arounds if one uses ordinary vectors (such as in the post by Loren). But here the curves are symbolic ones generated from ezplot. Any solution?
Answers (2)
PetK
on 11 Mar 2012
Finding the intersection means solving, right? right.
well just do:
solve('sqrt(8-e)=sqrt(e) * tan(pi/2 * sqrt(e))','e')
and
solve('sqrt(8-e)=-sqrt(e) * cot(pi/2 * sqrt(e))','e')
the answer to each is the intersection of each of the two pairs of curves you are plotting.
regards,
p.k.
1 Comment
Walter Roberson
on 11 Mar 2012
In MuPAD you are very likely to get "explicit solution cannot be found".
Walter Roberson
on 11 Mar 2012
0 votes
Not really. Finding the intersection of these curves is trying to solve a non-trivial trig formula analytically : there are simply no tools to find the analytic solutions.
You can experiment with tools such as taylor expansion (but then you lose any periodic behavior), but as you do that towards higher orders of accuracy you generate polynomials in higher degrees and as you know there are no general solutions to polynomials of degree 5 or higher.
You can work towards numeric solutions by way of using solve() and then seeking numeric solutions for the expression forms that result. This can yield useful forms in Maple, but MuPAD has not been very good at expressing general forms of solutions to trig expressions; it has perhaps improved in that in later versions.
8 Comments
PetK
on 11 Mar 2012
Sure. But i think it actually does the job.
Walter Roberson
on 11 Mar 2012
MuPAD up through R2010a would certainly not be able to create symbolic roots for transcendental equations. I have not seen enough output from R2010b and later to know what it can or cannot handle now.
Ultrazord
on 12 Mar 2012
PetK
on 12 Mar 2012
yes this is actually a matlab bug if i gather correctly. use fsolve and set x0=0 initially, and when you get the answer use xo>ans and find the second root. your first problem has two roots if i understand correctly and your second problem only one, so solve should do the job.
Ultrazord
on 13 Mar 2012
PetK
on 14 Mar 2012
did you try it?
Ultrazord
on 14 Mar 2012
Walter Roberson
on 16 Mar 2012
If you happen to be using the Maple symbolic engine (an option in R2009A), then solve() of the expression may return incorrect values. I have identified the problem and reported it against Maple.
I do not have MuPAD to test with so I do not know if MuPAD ever suffered the same fault.
For now at least, if you use solve() with trig functions that involve sqrt() in the expression, then cross-check the solutions.
Categories
Find more on Common Operations 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!