Point of intersection of 'symbolic' curves

20 vues (au cours des 30 derniers jours)
Ultrazord
Ultrazord le 11 Mar 2012
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?

Réponses (2)

PetK
PetK le 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 commentaire
Walter Roberson
Walter Roberson le 11 Mar 2012
In MuPAD you are very likely to get "explicit solution cannot be found".

Connectez-vous pour commenter.


Walter Roberson
Walter Roberson le 11 Mar 2012
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 commentaires
Ultrazord
Ultrazord le 14 Mar 2012
I am using MATLAB R2009A, and the help tells that fsolve accepts only vector. :-(
However, it does work with symbolic too. :-)
Thanks.
Walter Roberson
Walter Roberson le 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.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by