필터 지우기
필터 지우기

Level curves to two functions for solving nonlinear system of equations.

조회 수: 1 (최근 30일)
Snirisa  Gödel
Snirisa Gödel 2014년 2월 26일
편집: John D'Errico 2014년 2월 26일
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).
if true
% %%
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,100)
end

답변 (1개)

John D'Errico
John D'Errico 2014년 2월 26일
편집: John D'Errico 2014년 2월 26일
It looks like you are almost there.
Use contourc to get the contours as a set of polygons. Then use a tool from the file exchange to generate the intersections between the polygons. Doug's curve intersections tool is the one I'd choose.
In the event that there are several broken polygons produced by contourc, you will need to be careful to ensure you find all the intersections.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by