Level curves to two functions (Contour plot)

3 Ansichten (letzte 30 Tage)
Snirisa  Gödel
Snirisa Gödel am 26 Feb. 2014
Bearbeitet: John D'Errico am 26 Feb. 2014
I want to solve a system of nonlinear equations:
x^2 + y*sin(y) - 3 = 0 x*y + exp(x) + y -5 = 0
So I introduced the two functions f1 = x^2 + y*sin(y) - 3 and f2 = x*y + exp(x) + y -5. Now I am trying to plot the level curves(at 0) so I can see how many solutions exists. But I am unable to plot a meaningful result(i.e finding the intersections).
%
x=linspace(-15,15,400);
y=linspace(-15,15,400);
f=@(x,y)(x.^2+y.*sin(y)-3);
[X,Y]=meshgrid(x,y);
Z=f(X,Y);
contour(X,Y,Z,10)
hold on
f=@(x,y)(x.*y+exp(x)+y-5);
[X,Y]=meshgrid(x,y);
Z=f(X,Y);
contour(X,Y,Z,10)
end
  1 Kommentar
John D'Errico
John D'Errico am 26 Feb. 2014
Bearbeitet: John D'Errico am 26 Feb. 2014
PLEASE don't just ask the same question repeatedly. The only thing you changed here was to remove the useless "if true". Anyway why was my answer to your last (virtually identical) question inadequate?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by