0
$\begingroup$

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

w=2*Pi*f;
Zc=(1/i*w*C)
Zl=(i*w*L)
Z1=(R*Zc)/(1+Zc*Zl)

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.

$\endgroup$
2
$\begingroup$

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

ClearAll[f]
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

 LogLogPlot[mag,{f,0,30},PlotRange->All,Frame->True,
    FrameLabel->{{"|mag|",None},{"frequency in Hz","my plot"}}]

Mathematica graphics

Update To answer comment.

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

Plot[ComplexExpand@Arg@Z1,{f,0,30},PlotRange->All,Frame->True,
    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

| improve this answer | |
$\endgroup$
  • $\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
0
$\begingroup$
ClearAll[f]
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

| 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.