# 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)
Jayesh Patil il 6 Apr 2015
Risposto: John D'Errico il 7 Apr 2015
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
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

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.
ezplot('x.^2*y.^2+2*x.*y.*sin(y)-2*cos(y)+1',[-10,10],[-10,10])
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.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Più risposte (1)

luc il 7 Apr 2015
Does this do what you want it to do?
syms x y
[xx,yy]=solve((x^2)*(y^2)+2*x*y*sin(y)-2*cos(y)==-1,x,y)
I've added the double == sign and added that the solver finds a solution for x and y.
Hope this helps.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Code Performance in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by