1
$\begingroup$

I have the following function:

freq[a_, b_, t0_, tr_, s_] := -((b E^(-s (b + t0)) (b E^(s (b + t0)) (-1 + 
           b s) UnitStep[-b] - b E^(s t0) UnitStep[b] + 
        E^(s (b - tr)) (E^(s (t0 + tr)) (-1 + b s) UnitStep[-t0] + 
           E^(s tr) (-1 + b s - s t0) UnitStep[t0] - 
           E^(s (t0 + tr)) (-1 + b s) UnitStep[-t0 - tr] + (1 + 
              s (-b + t0 + tr)) UnitStep[t0 + tr])))/(s^2 tr))

Now I want to plot the function as follows:

Plot[ComplexExpand@Abs@ExpToTrig@freq[0, 1, 0, 10^-6, Iw], {w,0,10^9}]

However that doesn't work. I couldn't exact the absolute value of the complex function to plot it.
(w is a real positive number)

Does anyone know how to plot that?

$\endgroup$
2
  • 1
    $\begingroup$ Iw should have a space in between, or use I*w $\endgroup$
    – flinty
    Jul 9, 2020 at 19:44
  • $\begingroup$ @flinty thanks! It took me one hour trying different methods. $\endgroup$
    – emnha
    Jul 9, 2020 at 19:55

1 Answer 1

2
$\begingroup$

As mentioned by flinty, Iw should be I*w; and LogLinearPlot makes it easier to visualize.

freq[a_, b_, t0_, tr_, 
  s_] := -((b E^(-s (b + t0)) (b E^(s (b + t0)) (-1 + b s) UnitStep[-b] - 
        b E^(s t0) UnitStep[b] + 
        E^(s (b - tr)) (E^(s (t0 + tr)) (-1 + b s) UnitStep[-t0] + 
           E^(s tr) (-1 + b s - s t0) UnitStep[t0] - 
           E^(s (t0 + tr)) (-1 + b s) UnitStep[-t0 - tr] + (1 + 
              s (-b + t0 + tr)) UnitStep[t0 + tr])))/(s^2 tr))

LogLinearPlot[Evaluate[Abs@ExpToTrig@freq[0, 1, 0, 10^-6, I*w]], {w, 0, 10^9}]

enter image description here

$\endgroup$
1
  • $\begingroup$ That's a good idea! $\endgroup$
    – emnha
    Jul 9, 2020 at 19:58

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.