2
$\begingroup$

How can I make this plot easier to see? In this plot the waverform is not clear. If I plot with w only from 0 to 1000 it is better but I wonder if there is a way to see in a wider range.

result = LaplaceTransform[
   a + ((b - a)/tr t - (b - a)/tr t0) (UnitStep[t - t0] - 
       UnitStep[t - (t0 + tr)]) + (b - a) UnitStep[t - (t0 + tr)], t, 
   s];
freq[a_, b_, t0_, tr_, s_] := Evaluate@result;
LogLinearPlot[
 Evaluate[Abs@ExpToTrig@freq[2, 3, 10, #, I*w] & /@ 
   Range[ 1 10^-9, 1 10^-6, 10^-7]], {w, 0, 10^9}, 
 GridLines -> Automatic, PlotLegends -> Range[10], PlotPoints -> 500]

enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ What are you trying to show? Perhaps LogLogPlot would work better. $\endgroup$
    – Bob Hanlon
    Jun 10 at 15:07
  • $\begingroup$ @BobHanlon I want to check how tr changes frequency range. I just tried LogLogPlot but it doesn't look good either. $\endgroup$
    – emnha
    Jun 10 at 15:18
  • $\begingroup$ You have to plot over a very narrow domain, or you'll get a mess. E.g., {w, 9*10^6, 9.000002*10^6} or {w, 9*10^8, 9.00000002*10^8}. To check dependence on tr, perhaps Simplify[Abs@ExpToTrig@freq[2, 3, 10, tr, I*w], 1 10^-9 < tr < 1 10^-6] // ComplexExpand // FullSimplify is sufficiently simple to analyze. $\endgroup$
    – Michael E2
    Jun 10 at 16:13
  • $\begingroup$ @MichaelE2: Doesn't work for me. $\endgroup$
    – user64494
    Jun 10 at 17:14
3
$\begingroup$

It would be preferable if you limited the number of functions being displayed to one or at most two. You can do this with Manipulate

Clear["Global`*"]

freq[a_, b_, t0_, tr_, s_] = 
  LaplaceTransform[
    a + ((b - a)/tr t - (b - a)/tr t0) (UnitStep[t - t0] - 
        UnitStep[t - (t0 + tr)]) + (b - a) UnitStep[t - (t0 + tr)], t, s] // 
   Simplify;

trRng = Range[10^-9, 10^-6, 10^-7];

funcs = Simplify@ComplexExpand@Abs@
       freq[2, 3, 10, #, I*w] & /@ trRng;

To selectively display the functions:

Manipulate[
 If[sel === {}, sel = {1}];
 pltType[Evaluate@funcs[[sel]], {w, 0, 10^9},
  PlotStyle -> ColorData[97, "ColorList"][[sel]],
  GridLines -> Automatic,
  PlotLegends -> LineLegend[
    ColorData[97, "ColorList"][[sel]],
    N[10^7*trRng[[sel]]],
    LegendLabel -> Style[#, 12, Bold] &@
     StringForm["`` * tr", Superscript[10, 7]]],
  PlotPoints -> 200, (* flavor to taste *)
  MaxRecursion -> 5,
  WorkingPrecision -> 20,
  ImageSize -> Medium],
 {{pltType, LogLinearPlot, 
   Style["Plot type", 12]}, {LogLinearPlot -> LogLinear, 
   LogLogPlot -> LogLog}},
 Delimiter,
 {{sel, {1}, Style[#, 12] &@
    StringForm["`` * tr", Superscript[10, 7]]}, 
  Thread[Range[10] -> N[10^7 trRng]], ControlType -> CheckboxBar}]

enter image description here

Note that when displaying more than one function, you can move a function to the front by unchecking and then rechecking the box for that function.

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