0
$\begingroup$

I can plot the graph of a 3D function and the solution of an equation like in the following example:

Fi[x_, y_] := -x^2 - 2*y^2 + 3;
Fj[x_, y_] := -2*(x - 2)^2 - (y - 1)^2 + 4;

Plot3D[{Fi[x, y] - Fj[x, y]}, {x, -5, 5}, {y, -5, 5}]
ContourPlot[{Fi[x, y] - Fj[x, y] == 0}, {x, -5, 5}, {y, -5, 5}]

How can I combine these plots and plot the solution of the equation on the surface of the function?

$\endgroup$
1
$\begingroup$

Try

Plot3D[{Fi[x, y] - Fj[x, y]}, {x, -5, 5}, {y, -5, 5}, Mesh -> {{0}},MeshFunctions -> (#3 &)]

enter image description here

$\endgroup$
  • $\begingroup$ Thank You. Is there a way to keep the Mesh and Plot the equation independently? What does #3 do in this case? $\endgroup$ – McLawrence Jun 17 '19 at 10:10
  • $\begingroup$ You want to plot the meshline as a 3D-curve? $\endgroup$ – Ulrich Neumann Jun 17 '19 at 10:13
  • $\begingroup$ No. I want to keep the Mesh as it was before and add the line of the equation on top of that. $\endgroup$ – McLawrence Jun 17 '19 at 10:15
  • 1
    $\begingroup$ Ok, just combine the two plots Show[{Plot3D["mesh as before"],Plot3D["contourline"] }] $\endgroup$ – Ulrich Neumann Jun 17 '19 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.