TransWikia.com

How can I make this plot easier to see?

Mathematica Asked on June 19, 2021

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

One Answer

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.

Answered by Bob Hanlon on June 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP