4
$\begingroup$

I have a 3D plot like:

Ds=
1 - I ((0.602499 Sqrt[1 - 0.075076/(I si + sr)])/(
    0.550556-I si - sr) + (
    0.101418 Sqrt[1 - 0.075076/(I si + sr)])/(
    1.17669-I si - sr) + (
    5.66507 Sqrt[1 - 0.075076/(I si + sr)])/(
    2.23017-I si - sr) + (
    0.920849 Sqrt[1 - 0.075076/(I si + sr)])/(
    3.18056-I si - sr) + (1/(64 \[Pi]))
    Sqrt[1 - 0.075076/(
      I si + sr)] (-1365.06 + 
       1/(-0.075076 + I si + sr)
         4 (30.8579 Log[1 + 0.31441 (-0.075076 + I si + sr)] + 
          189.838 Log[1 + 0.448396 (-0.075076 + I si + sr)] + 
          3.39856 Log[1 + 0.849842 (-0.075076 + I si + sr)] + 
          20.1899 Log[1 + 1.81635 (-0.075076 + I si + sr)])));

Plot3D[Re[Ds], {sr, -.3, .3}, {si, -0.3, .3}]

I want to draw a 2D plot in which Re[Ds] is a vertical axes and sr is a horizontal one. Or its better to say I want to view my 3D plot in certain planes.

$\endgroup$

2 Answers 2

12
$\begingroup$

One can add an appropriate RegionFunction in Plot3D, e.g. assuming a xz-plane where y == 2 x + 1 :

Plot3D[ Sin[ x + y^2], {x, -3, 3}, {y, -4, 4}, 
        RegionFunction -> Function[{x, y, z}, 2 x - y < 0], Filling -> Bottom,
        FillingStyle -> Directive[Red, Opacity[0.6]], PlotPoints -> 150, BoxRatios -> {6, 8, 2}]

enter image description here

Assuming one wants a 2D plot, we have to add a rule linking y nad x, e.g. y -> 2x + 1, thus:

Plot[ Sin[x + y^2] //. y -> 2 x + 1, {x, -2, 2}, Filling -> Bottom, 
      FillingStyle -> Directive[ Red, Opacity[0.5]], AspectRatio -> 1/2]

enter image description here

Edit

This queston was edited a few times and now it is quite different from the original one. Let's define Ds this way calling it S :

S[ x_, y_] := 1 - I ((0.602499 Sqrt[1 - 0.075076/(I  y + x)])/(0.550556 - I y - x ) 
            + ( 0.101418 Sqrt[1 - 0.075076/(I  y + x)])/(1.17669 - I y - x ) 
            + ( 5.66507 Sqrt[1 - 0.075076/(I  y + x)])/(2.23017 - I y - x ) 
            + ( 0.920849 Sqrt[ 1 - 0.075076/(I y + x)])/( 3.18056 - I y - x ) 
            + (1/(64 Pi)) Sqrt[ 1 - 0.075076/(I y + x)] (-1365.06 + 1/(-0.075076 + I y + x)
              4 (   30.8579 Log[ 1 + 0.31441 (-0.075076 + I y + x)]
                  + 189.838 Log[ 1 + 0.448396 (-0.075076 + I y + x)]
                  + 3.39856 Log[ 1 + 0.849842 (-0.075076 + I y + x)] 
                  + 20.1899 Log[ 1 + 1.81635 (-0.075076 + I y + x)] )))

now we can plot it in 3D as a function over a domain in the complex plane :

Plot3D[ Re[ S[ x, y]], {x, -3, 3}, {y, -0.5, .2}, PlotPoints -> 100, ClippingStyle -> None]

enter image description here

or restricting S to a submanifold (in this case to a line y == 2 x + 1) :

 Plot[ Re[ S[ x, 2 x + 1]], {x, -.48, 0}, PlotStyle -> Thick, Filling -> Axis, 
                                    FillingStyle -> Directive[Red, Opacity[0.5]] ]

enter image description here

we can use also Show and ParametricPlot3D :

Show[
      ParametricPlot3D[{ x, 2 x + 1 - y, Re[S[x, y]]},
                         {x, -.5, 0}, {y, -2, 2}, PlotStyle -> Opacity[0.46], PlotPoints -> 100], 
      Plot3D[ Re[ S[ x, 2 x + 1]], {x, -.5, 0}, {y, -0.1, 0.1}, Axes -> False, Boxed -> False,
              Filling -> Bottom, FillingStyle -> Directive[Red, Opacity[0.5]]],

              BoxRatios -> {1, 2, 1}]

enter image description here

$\endgroup$
9
  • $\begingroup$ thanks but I want mathematica to draw a 2D plot( a plane) which one axes is x and another is z. $\endgroup$
    – Kheeyal
    Aug 13, 2012 at 9:44
  • $\begingroup$ So update your question ! $\endgroup$
    – Artes
    Aug 13, 2012 at 9:45
  • $\begingroup$ I updated my question. $\endgroup$
    – Kheeyal
    Aug 13, 2012 at 9:52
  • $\begingroup$ Ok. I have the following plot: Plot3D[Re[Ds], {sr, -.3, .3}, {si, -0.3, .3}] in which Ds is a complicated complex function of sr and si. Now I want to see Re[Ds] versus sr in a plane. $\endgroup$
    – Kheeyal
    Aug 13, 2012 at 10:05
  • 1
    $\begingroup$ @soodeh Why don't you register your account to benefit more from this site ? $\endgroup$
    – Artes
    Aug 13, 2012 at 11:07
5
$\begingroup$

Something like this?

Plot[Table[Re[Ds], {si, Range[-.3, .3, .1]}], {sr, -.3, .3}, 
 Evaluated -> True, Filling -> Axis]

enter image description here

or

plt1 = Plot3D[Re[Ds], {sr, -.3, .3}, {si, -0.3, .3}, 
    PlotStyle -> Opacity[.5], Mesh -> None];
mesh = Range[-.3, .3, .1];
plt2 = ParametricPlot3D[{sr, #, Re[Ds] /. si -> #} & /@ 
    mesh, {sr, -.3, .3}, Evaluated -> True, 
    BoxRatios -> 1, ColorFunction -> Function[{x, y, z}, Hue[y]], 
    PlotStyle -> Thick, 
    FaceGrids -> {{{-1, 0, 0}, {mesh, None}}, 
     {{1, 0, 0}, {mesh, None}}, 
     {{0, 0, -1}, {None, mesh}}, 
     {{0, 0, 1}, {None, mesh}}},
    PlotRangePadding -> 0];
 Show[plt2, plt1]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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