Hi, I tried to solve the below equation in Matlab but it gave me no explicit solution. I also want to plot it y versus x.Please help explain to me.

1 visualizzazione (ultimi 30 giorni)
syms x y
>> solve('x^2*y^2+2*x*y*sin(y)-2*cos(y)=-1',y)
Warning: Explicit solution could not be found.
> In solve at 179

Risposta accettata

John D'Errico
John D'Errico il 7 Apr 2015
No problem to plot it. Note that I moved the -1 on the right hand side to the left of the equality so that ezplot can handle it.
grid on
HOWEVER... IF you want to solve for values of x such that this curve crosses the y axis, Note that the plot never seems to cross the y axis. There are no values of x such that y is zero.
If you want to solve for pairs of points (x,y) that solve the nonlinear equation, there are infinitely many such solutions. In fact, for any value of x, there are at least two such solutions, and I see 4 solutions (for x near zero.)
Similarly, if you choose to fix ANY value of y, there will be zero or two real solutions, since what remains will be a quadratic polynomial in x.
Note that solve itself must fail to produce all those solutions. In fact, the solution that luc proposes indeed does fail to produce the full set. So beware, as solve does NOT always produce all valid solutions for something like this.

Più risposte (1)

luc il 7 Apr 2015
Does this do what you want it to do?
syms x y
I've added the double == sign and added that the solver finds a solution for x and y.
Hope this helps.

Community Treasure Hunt

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

Start Hunting!

Translated by