2

I have the following two questions

  1. How to visualize the dependence Y versus X with Mathematica using ContourPlot, if it is given by the following system of two equations:

    Y=f(X,Z) and g(X,Z)=0

  2. How to return the points {Xi,Zi} generated by ContourPlot applied to g(X,Z)=0 that visualizes Z=q(X).

Remark 1: The answer on the second question resolves evidently the problem formulated in the first question Remark 2: In fact the problem formulated in the first question may be effectively solved without ContourPlot by differentiating in X both equations, and numerical solving the resulting system of 2 ordinary differential eqs

Any help and suggestions are appreciated.

Yuri
  • 53
  • 4
  • 3
    Hello, Yuri ! You would have to add a simple working example to illustrate the functionality and you should format your code properly - To do so, please, refer to the documentation centre. – Sektor Jan 29 '14 at 19:30
  • For your second question, there are several examples on this site of extracting contours from ContourPlot. I don't understand the first question, surely a function like y[x] depending on only one parameter would be visualised with Plot – Simon Woods Jan 29 '14 at 20:18
  • Thanks all for your comments, I edited my questions to make them more clear – Yuri Jan 29 '14 at 21:41
  • 1
    As Sektor suggested, can you please post a simple working example with definitions of $f$ and $g$ so that people have something to work with? –  Jan 29 '14 at 21:58
  • My own functions are too complicate in order to be used as an example, while I rather need in the general solution. By the way Matlab provides returning of the points generated by the contour plot that defines the contour (as asked in question 2) – Yuri Jan 29 '14 at 22:07

1 Answers1

0

Perhaps something like this is what you are looking for:

g[x_, z_] := x^3 + z
f[x_, z_] := x - z^2

Create a contour plot of g[x, z] == 0

cp = ContourPlot[g[x, z] == 0, {x, -1, 1}, {z, -1, 1}]

enter image description here

Extract the {x, z} coordinates of the line:

xz = First@Cases[Normal@cp, Line[data_] :> data, -1];

Create a list of {x, y} coordinates using y = f[x, z]:

xy = {#, f[##]} & @@@ xz;

Plot the line of y vs x:

ListLinePlot[xy]

enter image description here

Simon Woods
  • 84,945
  • 8
  • 175
  • 324
  • Simon, many thanks for your answer. I'm a beginner in Wolfram Math., and I will check your solution. Yuri – Yuri Jan 29 '14 at 22:17