0
$\begingroup$

How can I see the variation of 'y' for different values of 'x' using a plot in which 'y' are complex numbers ?

xValuesDb = 
  {6.*10^-6, 0.050006, 0.100006, 0.150006, 0.200006, 0.250006, 
   0.300006, 0.350006, 0.400006, 0.450006, 0.500006, 0.550006, 
   0.600006, 0.650006, 0.700006, 0.750006, 0.800006, 0.850006, 
   0.900006, 0.950006}

yValues = 
  {0.0499359 + 0.00218364 I, 0.0502323 + 0.00220999 I, 0.0505305 + 0.00223666 I, 
   0.0508304 + 0.00226367 I,  0.0511322 + 0.002291 I, 0.0514358 + 0.00231868 I, 
   0.0517412 + 0.00234669 I, 0.0520484 + 0.00237506 I,  0.0523575 + 0.00240377 I, 
   0.0526684 + 0.00243284 I,  0.0529812 + 0.00246227 I, 0.0532959 + 0.00249207 I, 
   0.0536125 + 0.00252223 I, 0.0539309 + 0.00255277 I, 0.0542513 + 0.00258369 I, 
   0.0545737 + 0.002615 I,  0.0548979 + 0.0026467 I, 0.0552242 + 0.00267879 I, 
   0.0555524 + 0.00271128 I, 0.0558826 + 0.00274418 I}

xyValuesAll = 
  MapThread[Riffle[{#1},{#2}]&, {xValuesDb, yValues}, 1] = 
    MapThread[Riffle[{#1},{#2}]&, {{xValuesDb, {131.263, yValues}},1]

ListPlot[xyValuesAll,
  AxesOrigin -> {λMin, 0},
  AxesLabel->{"BS density","Coverage Probability"}] 
$\endgroup$
  • $\begingroup$ Your code cannot be executed because you have not provided an example of {xValuesDb, yValues}. $\endgroup$ – Bob Hanlon Jan 18 '17 at 19:52
  • $\begingroup$ @BobHanlon Thanks, I edited the question. $\endgroup$ – Mounia Hamidouche Jan 18 '17 at 23:06
  • $\begingroup$ one possibility would be to have a 3DPlot with the z axis representing the imaginary part of y. $\endgroup$ – ivbc Jan 19 '17 at 1:32
1
$\begingroup$
xValuesDb = {6.*10^-6, 0.050006, 0.100006, 0.150006, 0.200006, 
   0.250006, 0.300006, 0.350006, 0.400006, 0.450006, 0.500006, 
   0.550006, 0.600006, 0.650006, 0.700006, 0.750006, 0.800006, 
   0.850006, 0.900006, 0.950006};

yValues = {0.0499359 + 0.00218364 I, 0.0502323 + 0.00220999 I, 
   0.0505305 + 0.00223666 I, 0.0508304 + 0.00226367 I, 
   0.0511322 + 0.002291 I, 0.0514358 + 0.00231868 I, 
   0.0517412 + 0.00234669 I, 0.0520484 + 0.00237506 I, 
   0.0523575 + 0.00240377 I, 0.0526684 + 0.00243284 I, 
   0.0529812 + 0.00246227 I, 0.0532959 + 0.00249207 I, 
   0.0536125 + 0.00252223 I, 0.0539309 + 0.00255277 I, 
   0.0542513 + 0.00258369 I, 0.0545737 + 0.002615 I, 
   0.0548979 + 0.0026467 I, 0.0552242 + 0.00267879 I, 
   0.0555524 + 0.00271128 I, 0.0558826 + 0.00274418 I};

xyValuesAllRe = Transpose[{xValuesDb, Re /@ yValues}];

xyValuesAllIm = Transpose[{xValuesDb, Im /@ yValues}];

xyValuesAllAbs = Transpose[{xValuesDb, Abs /@ yValues}];

ListPlot[
 {xyValuesAllRe, xyValuesAllIm, xyValuesAllAbs},
 PlotStyle -> {Directive[Red, Thick], Green,
   Directive[Blue, AbsoluteDashing[{10, 10}]]},
 Joined -> True,
 Frame -> True,
 FrameLabel -> (Style[#, 12, Bold] & /@
    {"BS density", 
     "Coverage Probability"}),
 PlotLegends -> {Re, Im, Abs}]

enter image description here

| improve this answer | |
$\endgroup$
0
$\begingroup$

Another nice way to do it is using a 3d plot. Just add this code to your definitions:

points = Table[{xValuesDb[[i]], Re@yValues[[i]], Im@yValues[[i]]}, {i,
Length@xValuesDb}]

ListPointPlot3D[points, AxesLabel -> {"X", "Re@Y", "Im@Y"}, 
PlotRange -> All]

result

| improve this answer | |
$\endgroup$

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.