I want to plot a complex function wrt frequency. How can i do it? If my function as follows:


where i==> imaginary number. let Z1 be an imaginary number = a+ib in terms of frequency; I want to plot phase of Z1 wrt frequency.


Normally one uses transfer function in s and then calls BodePlot. Bode replaces s by I w and then plots the magnitude and phase as function of w.

So your question is not clear. You give no context and meaning to the variables you wrote.

But may be this is can get you started. First need some numerical values for the parameters

R0 = 10; C0 = 3; L0 = 4;
w = 2*Pi*f;
Zc = (1/I*w*C0)
Zl = (I*w*L0)
Z1 = (R0*Zc)/(1 + Zc*Zl)
mag = ComplexExpand[Abs@Z1]

Mathematica graphics

Now you plot the magnitudes vs. f in Hz as follows

    FrameLabel->{{"|mag|",None},{"frequency in Hz","my plot"}}]

Mathematica graphics

Update To answer comment.

To plot phase. It is -Pi/2 for all frequencies.

    FrameLabel->{{"Phase",None},{"frequency in Hz","my plot"}}]

Mathematica graphics

To plot mag vs. phase (since phase is fixed at -Pi/2 you get straight line), you can use ParametricPlot

ParametricPlot[{mag, ComplexExpand@Arg@Z1},{f,0,30},PlotRange->All,
  Frame->True,FrameLabel->{{"Phase",None},{"|mag|","my plot"}}]

Mathematica graphics

  • $\begingroup$ I want exactly same thing which you gave to me .... but i want to plot the graph of phase vs freq............. what syntax i can use for phase instead of mag = ComplexExpand[Abs@Z1] $\endgroup$ – Jadav Dec 8 '17 at 11:45
  • $\begingroup$ @Jadav to find phase, you use Arg. But it is better to use BodePlot for all these things if you can. $\endgroup$ – Nasser Dec 8 '17 at 15:04
R0 = 10; C0 = 30; L0 = 4;
w[f_] = 2*Pi*f;
Zc[f_] = (1/I*w[f_]*C0)
Zl[f_] = (I*w[f_]*L0)
Z1[f_] = (R0*Zc[f_])/(1 + Zc[f_]*Zl[f_])

N[A, 3] = Abs[Trans[f]];
N[B, 3] = Arg[Trans[f]]*180/Pi;
Plot[Abs[Trans[f]], {f, 1*10^8, 10*10^9}]
Plot[Arg[Trans[f]]*180/Pi, {f, 7.8*10^9, 8.2*10^9}]

for magnitude

enter image description here

for phase enter image description here

Any suggestions are welcomed. Thank you @Nasser


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.