Solving an implicit equation involving complex numbers

4 views (last 30 days)
Dear experts,
I am having the following problem:
I am given with an implicit function of the form:
F(x,y)=0
where x is in the interval [0,2] and y is a complex number (namely, F is a polynomial of fourth order, of the form F(x,y) = y^4 (...) + y^3 (...) + y^2 (...) +y (...) + (...) ) .
My aim is to plot imag(y) against x , and real(y) against x, but I have no idea how to do it .
I have tried using the Contour function, and Ezplot function, but it seems like they do not know how to handle complex numbers (before I use the functions , I need to use meshgrid, which immediately takes y as a real number... ) .
Will someone please help me?
Thanks in advance !

Accepted Answer

Roger Stafford
Roger Stafford on 25 Aug 2014
If you can express each of the four coefficients of your polynomial as functions of x, I would recommend using matlab's 'roots' function. Use 'linspace' to generate a large number of equally-spaced values of x between 0 and 2, and call 'roots' for each one in a for-loop. You will get four roots for each value of x and you can divide them up into four real values and four imaginary values. That will allow you to make four plots of the real values and four plots of the imaginary values.
Note that the order among the four roots is more or less arbitrary so the plot you obtain only makes sense if all four real y values are plotted together, and the same with the four imaginary values.

More Answers (0)

Categories

Find more on Loops and Conditional Statements 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!