Find all points of intersection between two functions
Show older comments
syms x
ezplot(@(x)x^6 ,[-10,10,-10,10])
hold on
ezplot(@(x)3^x ,[-10,10,-10,10])
hold off
I have functions f(x) = x^6 and g(x) = 3^x. I made the graph of two functions, but is there any ways that I can find all points of intersection between two functions?
Answers (1)
Star Strider
on 17 Feb 2019
There are only 2 real intersection points. To find them, you simply need to find out the x-values where the functions equal each other, or equivalently where the difference between them is 0:
intsx = solve(x^6 == 3^x , x)
or:
intsx = solve(x^6 - 3^x == 0 , x)
then:
intsxn = vpa(intsx)
giving the 2 real roots:
intsxn =
1.2593399329995780507387959662256
-0.8550750819209264565809050645918
and 4 complex roots.
Categories
Find more on Get Started with MATLAB 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!