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.
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
John D'Errico
2015 年 4 月 7 日
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 件のコメント
その他の回答 (1 件)
luc
2015 年 4 月 7 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!