A two variable function is a surface. (@Sam Chak said this, but did not take the idea to the point of completion.) But if a surface has any solution, where it becomes zero, then almost always it will have infinitely many solutions. In fact, the tool which draws the zeros of such a function is usually called contour. That is, you want to effectively find a contour plot.
Yes, a contour plot usually is drawn with many contours at different levels, but a contour plot is what you want, all the same. You want to see only ONE contour drawn, at z == 0. Again, a contour plot can be thought of as the set of values (x,y), suze that z(x,y) is a level surface, so z(x,y) is equal to some given constant, here zero.
For an example, I'll use a symbolic function, as there are nice tools we can use. But a function handle will also work, or just an m-file. ANY function of two independent variables will work. Of course, you want it to be a continuous function, as if not, things will get very messy.
z = x^3 - y^3 + x^2*y^2 - 3
z = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1674406/image.png)
again, we cannot simply solve for a zero of that function, as there will be infintiely many such zeros, if any exist. We might do this:
The curve drawn in cyan is the locus of points that solve the problem z(x,y)==0, so the level set of z, at z==0. As I said, not one solution. The problem is, a tool like fsolve will produce only one solution, it will not understand there are infinitely many such solutions, just finding only one point on one of those curves, and the solution it does find will be a function of the starting value you give it.
And of course, finding the "equation" of those curves here will be a very complicated looking thing, and that is for a rather simple problem to write. We can actually find at least a set of points that will approximate those curves, using the contourc function.
So what is it you want to see? Just a plot of the solutions? Then use tools like fcontour, or contour. I could also have used fimplicit. If your goal is a set of solutions, then we could use contourc. For example...
zfun = @(x,y) x.^3 - y.^3 + x.^2.*y.^2 - 3;
xy = contourc(Xv,Yv,Z,[0 0])
xy =
0 -2.3787 -2.3737 -2.3603 -2.3420 -2.3238 -2.3058 -2.2881 -2.2727 -2.2706 -2.2528 -2.2354 -2.2183 -2.2017 -2.1856 -2.1717 -2.1700 -2.1547 -2.1402 -2.1267 -2.1143 -2.1032 -2.0939 -2.0865 -2.0817 -2.0800 -2.0825 -2.0906 -2.1062 -2.1328
64.0000 5.0000 4.9712 4.8990 4.7980 4.6970 4.5960 4.4949 4.4054 4.3939 4.2929 4.1919 4.0909 3.9899 3.8889 3.7978 3.7879 3.6869 3.5859 3.4848 3.3838 3.2828 3.1818 3.0808 2.9798 2.8788 2.7778 2.6768 2.5758 2.4747
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
These are the solutions, split into two curves. Unfortunately contourc puts them into one array. Looking at the first column, we see [0;64]. That tells us the first contour had z==0, and there were 64 points found on that curve. The second branch of solutions had 146 points on it that were found.
So, if you want a set of solutions, then the simple approach is to use contourc. If you want only a plot, then just use one of the contour plotting tools.