1
$\begingroup$

This question already has an answer here:

I have the following

f[z_] = 1/(z + I)

Table[{f[z]}, {z, -10, 10}]

This produces a list of complex numbers. Is there a way to plot this as a list plot perhaps. I've tried the following but it plots nothing

ListPlot[{Re[data], Im[data]}]

Thanks

$\endgroup$

marked as duplicate by Artes, J. M. will be back soon Aug 30 '17 at 16:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ I think you want to equate data to the table and remove the curly brackets around f[z] $\endgroup$ – Jack LaVigne Aug 30 '17 at 15:44
1
$\begingroup$

The function ReIm is useful for this:

f[z_] := 1/(z+I)
data = Table[f[z],{z,-10,10}];

ListPlot[ReIm @ data]

enter image description here

$\endgroup$
  • $\begingroup$ Oh sweet! thank you $\endgroup$ – NumberCruncher Aug 30 '17 at 15:54
0
$\begingroup$
f[z_] := 1/(z + I)

tab = Table[f[z], {z, -10, 10}];

ListPlot[{Re @ tab, Im @ tab}, PlotLegends -> {Re, Im}]

enter image description here

Or

ListLinePlot[Transpose[{Re @ #, Im @ #}]] &[Table[f[z], {z, -10, 10, 0.1}]]

enter image description here

$\endgroup$
  • $\begingroup$ The second approach can be simplified to ListLinePlot[{Re[#], Im[#]} & /@ Table[f[z], {z, -10, 10, 0.1}]] or with v10.1 or later see answer by @CarlWoll $\endgroup$ – Bob Hanlon Aug 30 '17 at 17:35

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